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-13703] CodeCompletion: Assertion failed while printing generic signature: (Val && "isa<> used on a null pointer") #56100

Closed
nathawes opened this issue Oct 7, 2020 · 1 comment · Fixed by #59271
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 found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@nathawes
Copy link
Collaborator

nathawes commented Oct 7, 2020

Previous ID SR-13703
Radar rdar://problem/70057258
Original Reporter @nathawes
Type Bug
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, Crash, FoundByStressTester
Assignee None
Priority Medium

md5: 3188687bb08d406e0bbca0cdc9878dbf

Issue Description:

Reproducing test case:

// RUN: %swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename %s

extension Result {
  public init(_ value: Success?) {
    self = value.map(#^COMPLETE^#)
  }
}

public func materialize<T>(_ f: T) {}

Crash trace (via sourcekitd):

Thread 3 Crashed:
0   libsystem_kernel.dylib          0x00007fff6fc5333a __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff6fd0fe60 pthread_kill + 430
2   libsystem_c.dylib               0x00007fff6fbda8a2 __abort + 139
3   libsystem_c.dylib               0x00007fff6fbda817 abort + 135
4   libsystem_c.dylib               0x00007fff6fbd9ac6 __assert_rtn + 314
5   com.apple.SourceKitService.5.0.20200928101_osx  0x0000000106861ec1 swift::Decl::getInnermostDeclContext() const (.cold.1) + 33
6   com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f9f418 swift::Decl::getInnermostDeclContext() const + 136
7   com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f4f6f1 (anonymous namespace)::PrintAST::printSingleDepthOfGenericSignature(swift::ArrayRefView<swift::Type, swift::GenericTypeParamType*, swift::GenericTypeParamType* swift::staticCastHelper<swift::GenericTypeParamType>(swift::Type const&), true>, llvm::ArrayRef<swift::Requirement>, bool&, unsigned int, llvm::function_ref<bool (swift::Requirement const&)>) + 161
8   com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f4f608 (anonymous namespace)::PrintAST::printGenericSignature(swift::GenericSignature, unsigned int, llvm::function_ref<bool (swift::Requirement const&)>) + 1160
9   com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f5529a swift::TypeVisitor<(anonymous namespace)::TypePrinter, void>::visit(swift::Type) + 4410
10  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f44d83 swift::Type::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 67
11  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103f46785 swift::TypeBase::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 21
12  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fd12b2 swift::ide::CodeCompletionResultBuilder::addTypeAnnotation(swift::Type, swift::PrintOptions, llvm::StringRef) + 450
13  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fdadd8 (anonymous namespace)::CompletionLookup::addTypeAnnotation(swift::ide::CodeCompletionResultBuilder&, swift::Type, swift::GenericSignature) + 168
14  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fd78ff (anonymous namespace)::CompletionLookup::addCompoundFunctionNameIfDesiable(swift::AbstractFunctionDecl*, swift::DeclVisibilityKind, swift::DynamicLookupInfo) + 1759
15  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fd4e93 (anonymous namespace)::CompletionLookup::foundDecl(swift::ValueDecl*, swift::DeclVisibilityKind, swift::DynamicLookupInfo) + 307
16  com.apple.SourceKitService.5.0.20200928101_osx  0x000000010409aac2 swift::SourceLookupCache::lookupVisibleDecls(swift::ImportPath::Access, swift::VisibleDeclConsumer&, swift::NLKind) + 530
17  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fd33a9 deliverCompletionResults(swift::ide::CodeCompletionContext&, (anonymous namespace)::CompletionLookup&, swift::SourceFile&, swift::ide::CodeCompletionConsumer&) + 569
18  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102fe6c26 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 19990
19  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103e3ea55 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 933
20  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103e3e58a swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 234
21  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103e48e92 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 386
22  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103e48c9e llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::operator()<swift::CodeCompletionSecondPassRequest, (void*)0>(swift::CodeCompletionSecondPassRequest const&) + 110
23  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103e3e397 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 55
24  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102f0b561 void llvm::function_ref<void (swift::CompilerInstance&, bool)>::callback_fn<swiftCodeCompleteImpl(SourceKit::SwiftLangSupport&, llvm::MemoryBuffer*, unsigned int, (anonymous namespace)::SwiftCodeCompletionConsumer&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)::$_2>(long, swift::CompilerInstance&, bool) + 433
25  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103007999 swift::ide::CompletionInstance::performNewOperation(llvm::Optional<llvm::hash_code>, swift::CompilerInvocation&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 585
26  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000103007eb8 swift::ide::CompletionInstance::performOperation(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 696
27  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102f3fd74 SourceKit::SwiftLangSupport::performCompletionLikeOperation(llvm::MemoryBuffer*, unsigned int, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 2596
28  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102f04d4d SourceKit::SwiftLangSupport::codeComplete(llvm::MemoryBuffer*, unsigned int, SourceKit::OptionsDictionary*, SourceKit::CodeCompletionConsumer&, llvm::ArrayRef<char const*>, llvm::Optional<SourceKit::VFSOptions>) + 573
29  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102f6c678 handleSemanticRequest(sourcekitd::RequestDict, std::__1::function<void (void*)>, sourcekitd_uid_s*, llvm::Optional<llvm::StringRef>, llvm::Optional<llvm::StringRef>, llvm::ArrayRef<char const*>, llvm::Optional<SourceKit::VFSOptions>) + 2440
30  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102f6bbe8 void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_7>(void*) + 376
31  libdispatch.dylib               0x00007fff6fab2658 _dispatch_client_callout + 8
32  libdispatch.dylib               0x00007fff6fab4d79 _dispatch_block_invoke_direct + 245
33  com.apple.SourceKitService.5.0.20200928101_osx  0x000000010603ed8f executeBlock(void*) + 15
34  com.apple.SourceKitService.5.0.20200928101_osx  0x0000000102ee921d threadFuncSync(void*) + 13
35  libsystem_pthread.dylib         0x00007fff6fd10109 _pthread_start + 148
36  libsystem_pthread.dylib         0x00007fff6fd0bb8b thread_start + 15
@nathawes
Copy link
Collaborator Author

nathawes commented Oct 7, 2020

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
AnthonyLatsis added a commit to AnthonyLatsis/swift that referenced this issue Jun 5, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Dec 13, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
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 found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants