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-9003] Code completion assertion failure: (is<T>() && "Invalid accessor called"), function get, file llvm/include/llvm/ADT/PointerUnion.h #51506

Closed
nathawes opened this issue Oct 15, 2018 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-9003
Radar rdar://problem/45279106
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, CompilerCrash
Assignee @ahoppen
Priority Medium

md5: d94363e484b154a2ef3bb9984469b63b

Issue Description:

To reproduce:

$ git clone https://github.com/vapor/fluent
$ cd fluent
$ git checkout -f 270b6fa372f03809b9795e8f8b9d1c31267a0ff3
$ swift package generate-xcodeproj
$ open Fluent.xcodeproj 

Then in Xcode:

  1. Select the "Fluent-Package > Generic iOS Device" for scheme + destination and build

  2. Navigate to CacheEntry.swift

  3. On line 27, invoke code completion after "self." in "self.key = key" to get the trace below

Application Specific Information:
dyld2 mode
Stack dump:
0.  While walking into decl 'CacheEntry' at /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/fluent/Sources/Fluent/Cache/CacheEntry.swift:5:14
 
Assertion failed: (is<T>() && "Invalid accessor called"), function get, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/ADT/PointerUnion.h, line 136.
 
Thread 4 Crashed:
0   libsystem_kernel.dylib          0x00007fff7443bb86 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff744f1c50 pthread_kill + 285
2   libsystem_c.dylib               0x00007fff743a5268 __abort + 144
3   libsystem_c.dylib               0x00007fff743a51d8 abort + 142
4   libsystem_c.dylib               0x00007fff7436d868 __assert_rtn + 320
5   com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089e0284 swift::GenericSignatureBuilder::maybeResolveEquivalenceClass(swift::Type, swift::ArchetypeResolutionKind, bool) + 2404
6   com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089e036a swift::GenericSignatureBuilder::resolve(llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::FloatingRequirementSource) + 218
7   com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089e6f23 swift::GenericSignatureBuilder::addSameTypeRequirement(llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::GenericSignatureBuilder::UnresolvedHandlingKind, llvm::function_ref<void (swift::Type, swift::Type)>) + 147
8   com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089dc530 concretizeNestedTypeFromConcreteParent(swift::GenericSignatureBuilder::PotentialArchetype*, swift::GenericSignatureBuilder::PotentialArchetype*, swift::GenericSignatureBuilder&) + 1280
9   com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089e7dab swift::GenericSignatureBuilder::addSameTypeRequirementToConcrete(swift::GenericSignatureBuilder::ResolvedType, swift::Type, swift::GenericSignatureBuilder::RequirementSource const*) + 2203
10  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089e6f88 swift::GenericSignatureBuilder::addSameTypeRequirement(llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::GenericSignatureBuilder::UnresolvedHandlingKind, llvm::function_ref<void (swift::Type, swift::Type)>) + 248
11  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089d7cde swift::GenericSignatureBuilder::addRequirement(swift::Requirement const&, swift::RequirementRepr const*, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::SubstitutionMap const*, swift::ModuleDecl*) + 1950
12  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089da672 swift::GenericSignatureBuilder::addRequirement(swift::Requirement const&, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::ModuleDecl*) + 50
13  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a58cb2 substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolDecl*)>, swift::SubstOptions) + 2482
14  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a52526 swift::Type::subst(swift::SubstitutionMap, swift::SubstOptions) const + 118
15  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f538c3 (anonymous namespace)::CompletionLookup::getTypeOfMember(swift::ValueDecl const*, llvm::Optional<swift::Type>) + 451
16  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f5086f (anonymous namespace)::CompletionLookup::foundDecl(swift::ValueDecl*, swift::DeclVisibilityKind) + 3967
17  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a09760 lookupVisibleMemberDecls(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*, swift::GenericSignatureBuilder*) + 752
18  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a098d5 swift::lookupVisibleMemberDecls(swift::VisibleDeclConsumer&, swift::Type, swift::DeclContext const*, swift::LazyResolver*, bool, swift::GenericSignatureBuilder*) + 53
19  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f45724 (anonymous namespace)::CompletionLookup::getValueExprCompletions(swift::Type, swift::ValueDecl*) + 1204
20  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f409bb (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 10651
21  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001088b4420 (anonymous namespace)::ParseDelayedFunctionBodies::walkToDeclPre(swift::Decl*) + 288
22  com.apple.SourceKitService.4.2.2018100301_osx   0x000000010896409b (anonymous namespace)::Traversal::doIt(swift::Decl*) + 171
23  com.apple.SourceKitService.4.2.2018100301_osx   0x000000010896940b (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 459
24  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001089640c8 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 216
25  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108963fdb swift::Decl::walk(swift::ASTWalker&) + 27
26  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a1954a swift::SourceFile::walk(swift::ASTWalker&) + 170
27  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000108a1805f swift::ModuleDecl::walk(swift::ASTWalker&) + 95
28  com.apple.SourceKitService.4.2.2018100301_osx   0x00000001088abfe7 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 215
29  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f2ed09 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 841
30  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107f2e238 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 616
31  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107d9c89f swiftCodeCompleteImpl(SourceKit::SwiftLangSupport&, llvm::MemoryBuffer*, unsigned int, (anonymous namespace)::SwiftCodeCompletionConsumer&, llvm::ArrayRef<char const*>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 2511
32  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107d9be63 SourceKit::SwiftLangSupport::codeComplete(llvm::MemoryBuffer*, unsigned int, SourceKit::CodeCompletionConsumer&, llvm::ArrayRef<char const*>) + 131
33  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107df8c32 handleSemanticRequest(sourcekitd::RequestDict, std::__1::function<void (void*)>, sourcekitd_uid_s*, llvm::Optional<llvm::StringRef>, llvm::Optional<llvm::StringRef>, llvm::ArrayRef<char const*>) + 818
34  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107df887e void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_4>(void*) + 142
35  libdispatch.dylib               0x00007fff742aedcb _dispatch_client_callout + 8
36  libdispatch.dylib               0x00007fff742b1b68 _dispatch_block_invoke_direct + 260
37  com.apple.SourceKitService.4.2.2018100301_osx   0x000000010a8a051f executeBlock(void*) + 15
38  com.apple.SourceKitService.4.2.2018100301_osx   0x0000000107ebb5cd ExecuteOnThread_Dispatch(void*) + 13
39  libsystem_pthread.dylib         0x00007fff744ef33d _pthread_body + 126
40  libsystem_pthread.dylib         0x00007fff744f22a7 _pthread_start + 70
41  libsystem_pthread.dylib         0x00007fff744ee425 thread_start + 13
@nathawes
Copy link
Collaborator Author

@swift-ci create

@ahoppen
Copy link
Contributor

ahoppen commented Apr 26, 2021

I was unable to reproduce this with the swift-DEVELOPMENT-SNAPSHOT-2021-01-27-a toolchain. It appears to have been fixed in the meantime.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself labels Dec 12, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
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. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants