Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-995] Assertion "Interface type contains archetypes" after adding Sequence.Element #43607

Closed
gribozavr opened this issue Mar 20, 2016 · 9 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-995
Radar None
Original Reporter @gribozavr
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee @gregomni
Priority Medium

md5: 670505243739d0f09e62b6009bef98d9

Issue Description:

When I apply the attached patch, the compiler crashes with an assertion failure:

Interface type contains archetypes
(func_decl 'anonname=0x7fe58309e580' type='<Self : _ArrayBufferProtocol> (Self) -> (Int) -> Self.Iterator.Element' interface type='<τ_0_0 where τ_0_0 : _ArrayBufferProtocol, τ_0_0.Index : ForwardIndex, τ_0_0.Index.Distance : _SignedInteger, τ_0_0.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible, τ_0_0.Iterator : IteratorProtocol, τ_0_0.SubSequence : Collection, τ_0_0.SubSequence.Index : ForwardIndex, τ_0_0.SubSequence.Index.Distance : _SignedInteger, τ_0_0.SubSequence.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible, τ_0_0.SubSequence.Iterator : IteratorProtocol, τ_0_0.SubSequence.SubSequence : Indexable, τ_0_0.SubSequence.SubSequence : Sequence, τ_0_0.SubSequence.SubSequence.Index : ForwardIndex, τ_0_0.SubSequence.SubSequence.Index.Distance : _SignedInteger, τ_0_0.SubSequence.SubSequence.Index.Distance.IntegerLiteralType : _BuiltinIntegerLiteralConvertible, τ_0_0.SubSequence.SubSequence.Iterator : IteratorProtocol> τ_0_0 -> Int -> Self.Iterator.Element' access=public getter_for=subscript(_:)
  (parameter_list
    (parameter "self" type='Self'))
  (parameter_list
    (parameter "index" type='Int'))
  (result
    (type_ident
      (component id='Element' bind=Swift.(file).Sequence.Element@<src>/swift/stdlib/public/core/Sequence.swift:74:13))))
0  swift                    0x00000001058dc27b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x00000001058db4d6 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x00000001058dca9f SignalHandler(int) + 575
3  libsystem_platform.dylib 0x00007fff9769430a _sigtramp + 26
4  swift                    0x0000000106386405 FirstTarget + 73677
5  swift                    0x00000001058dc7b6 abort + 22
6  swift                    0x00000001036b9812 (anonymous namespace)::Verifier::verifyChecked(swift::ValueDecl*) + 578
7  swift                    0x00000001036bd22e (anonymous namespace)::Verifier::verifyChecked(swift::AbstractFunctionDecl*) + 12190
8  swift                    0x00000001036af195 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 4869
9  swift                    0x00000001036c0646 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 1606
10 swift                    0x00000001036c45a4 (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 260
11 swift                    0x00000001036c00ec (anonymous namespace)::Traversal::doIt(swift::Decl*) + 236
12 swift                    0x00000001036bffeb swift::Decl::walk(swift::ASTWalker&) + 27
13 swift                    0x0000000103762daa swift::SourceFile::walk(swift::ASTWalker&) + 170
14 swift                    0x00000001036a4b11 swift::verify(swift::SourceFile&) + 65
15 swift                    0x00000001035ed086 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1702
16 swift                    0x00000001033aea15 swift::CompilerInstance::performSema() + 4837
17 swift                    0x0000000102de8666 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 790
18 swift                    0x0000000102de7716 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2838
19 swift                    0x0000000102de2a49 main + 2729
20 libdyld.dylib            0x00007fff974b4489 start + 1
21 libdyld.dylib            0x0000000000000087 start + 1756675071
...
1.  While walking into decl '_ArrayBufferProtocol' at <src>/swift/stdlib/public/core/ArrayBufferProtocol.swift:15:8
2.  While verifying FuncDecl getter for subscript(_:) at <src>/swift/stdlib/public/core/ArrayBufferProtocol.swift:33:38
3.  While verifying AbstractFunctionDecl getter for subscript(_:) at <src>/swift/stdlib/public/core/ArrayBufferProtocol.swift:33:38
@gribozavr
Copy link
Collaborator Author

CC @gregomni

@belkadan
Copy link
Contributor

For posterity, what's the base revision you're applying the patch to?

@gribozavr
Copy link
Collaborator Author

I'm trying this on top of #1699

@belkadan
Copy link
Contributor

That's not stable either; @gregomni could update the pull request, and PRs are always applied on top of the current master. Is your patch a combined patch?

@gribozavr
Copy link
Collaborator Author

I'm not sure what your concern is – if it starts succeeding suddenly, I'm all for that.

@belkadan
Copy link
Contributor

That's not a sound approach to tracking down a bug. Any bugs reported ought to be as reproducible as possible. So, base revision + patch is okay, but pull requests and references to non-Apple repositories are not (unless Greg commits to keeping a branch around).

@gribozavr
Copy link
Collaborator Author

This is a bugreport for Greg's pull request. I don't see any other way to report this bug until the PR is merged.

@gregomni
Copy link
Collaborator

The code that ended up being the final commit in <https://github.com/apple/swift/pull/1699\> fixed the contains archetypes assertion. The next error with this patch is that the associated type name for ArrayLiteralConvertible is hard-coded into the compiler as "Element" and this patch changes that name. Made that part of the compiler more general in <https://github.com/apple/swift/pull/1821\>. (Now it just assumes there is a single associated type in ArrayLiteralConvertible but makes no assumption about its name.)

@gribozavr
Copy link
Collaborator Author

Thanks, Greg! These two PRs fixed the issue, but I'm hitting https://bugs.swift.org/browse/SR-1058 next.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants