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-12959] CodeCompletion: Assertion failed: (0 && "Bad base type"), function getContextSubstitutions #55405

Closed
nathawes opened this issue Jun 9, 2020 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion 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 Jun 9, 2020

Previous ID SR-12959
Radar rdar://problem/64141399
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee @ahoppen
Priority Medium

md5: 1329a8f49185dffaeb4ed22406b7f138

Issue Description:

Reproducer with latest master snapshot toolchain:

import SwiftUI

public struct MyView: View {
  @State var someProperty = /*complete here*/false
}

Trace:

0.  While performing new completion
1.  While evaluating request CodeCompletionSecondPassRequest(source_file "/private/tmp/sdsdfsddsfds/sdsdfsddsfds/main.swift", )
 
Assertion failed: (0 && "Bad base type"), function getContextSubstitutions, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/AST/Type.cpp, line 4022.

Thread 5 Crashed:
0   libsystem_kernel.dylib          0x00007fff6b42d33a __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff6b4e9e60 pthread_kill + 430
2   libsystem_c.dylib               0x00007fff6b3b48a2 __abort + 139
3   libsystem_c.dylib               0x00007fff6b3b4817 abort + 135
4   libsystem_c.dylib               0x00007fff6b3b3ac6 __assert_rtn + 314
5   com.apple.SourceKitService.5.0.20200604101_osx  0x000000010f101e93 swift::TypeBase::getContextSubstitutions(swift::DeclContext const*, swift::GenericEnvironment*) (.cold.13) + 35
6   com.apple.SourceKitService.5.0.20200604101_osx  0x000000010cc10549 swift::TypeBase::getContextSubstitutions(swift::DeclContext const*, swift::GenericEnvironment*) + 1417
7   com.apple.SourceKitService.5.0.20200604101_osx  0x000000010cc106ac swift::TypeBase::getMemberSubstitutions(swift::ValueDecl const*, swift::GenericEnvironment*) + 124
8   com.apple.SourceKitService.5.0.20200604101_osx  0x000000010cc10857 swift::TypeBase::getMemberSubstitutionMap(swift::ModuleDecl*, swift::ValueDecl const*, swift::GenericEnvironment*) + 71
9   com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc0d7ba (anonymous namespace)::collectPossibleCalleesByQualifiedLookup(swift::DeclContext&, swift::Type, swift::DeclNameRef, llvm::SmallVectorImpl<swift::ide::FunctionTypeAndDecl>&) + 986
10  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc0d3c0 (anonymous namespace)::collectPossibleCalleesByQualifiedLookup(swift::DeclContext&, swift::Expr*, swift::DeclNameRef, llvm::SmallVectorImpl<swift::ide::FunctionTypeAndDecl>&) + 448
11  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc0cded (anonymous namespace)::ExprContextAnalyzer::analyzeApplyExpr(swift::Expr*) + 3981
12  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc09832 swift::ide::ExprContextInfo::ExprContextInfo(swift::DeclContext*, swift::Expr*) + 962
13  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bbd9287 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 9463
14  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010c96140b swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 875
15  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010c960f93 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 211
16  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010c96aaf1 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 481
17  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010c96a8b6 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::operator()<swift::CodeCompletionSecondPassRequest, (void*)0>(swift::CodeCompletionSecondPassRequest const&) + 118
18  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010c960dc9 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 41
19  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bae2ad1 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, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)::$_2>(long, swift::CompilerInstance&, bool) + 433
20  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc06ca8 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)>) + 568
21  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bc07321 swift::ide::CompletionInstance::performOperation(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 849
22  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bb16f83 SourceKit::SwiftLangSupport::performCompletionLikeOperation(llvm::MemoryBuffer*, unsigned int, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 2547
23  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010badc825 SourceKit::SwiftLangSupport::codeComplete(llvm::MemoryBuffer*, unsigned int, SourceKit::OptionsDictionary*, SourceKit::CodeCompletionConsumer&, llvm::ArrayRef<char const*>, llvm::Optional<SourceKit::VFSOptions>) + 565
24  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bb44a73 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>) + 2387
25  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bb4403a void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_4>(void*) + 330
26  libdispatch.dylib               0x00007fff6b28c658 _dispatch_client_callout + 8
27  libdispatch.dylib               0x00007fff6b28ed79 _dispatch_block_invoke_direct + 245
28  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010e8f3a5f executeBlock(void*) + 15
29  com.apple.SourceKitService.5.0.20200604101_osx  0x000000010bac166d threadFuncSync(void*) + 13
30  libsystem_pthread.dylib         0x00007fff6b4ea109 _pthread_start + 148
31  libsystem_pthread.dylib         0x00007fff6b4e5b8b thread_start + 15
@nathawes
Copy link
Collaborator Author

nathawes commented Jun 9, 2020

@swift-ci create

@ahoppen
Copy link
Contributor

ahoppen commented Mar 26, 2021

Fixed in #36517

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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 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

No branches or pull requests

3 participants