Skip to content

Completion crash in inheritance clause #82208

Open
@hamishknight

Description

@hamishknight

The following completion crashes:

struct R<T> {}
extension R: T #^CC^#
Assertion failed: (!type->hasTypeParameter() && "no generic environment provided for type with type parameters"), function mapTypeIntoContext, file GenericEnvironment.cpp, line 337.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./swift-ide-test --code-completion --code-completion-token=CC -source-filename /Users/hamish/src/swift-test-arena/main.swift -sdk /Users/hamish/src/MacOSX.sdk
1.      While performing new IDE inspection
2.      While evaluating request IDEInspectionSecondPassRequest(source_file "/Users/hamish/src/swift-test-arena/main.swift", )
3.      While IDE inspecting starting at /Users/hamish/src/swift-test-arena/main.swift:1268:16
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-ide-test           0x0000000107a04eac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-ide-test           0x0000000107a0360c llvm::sys::RunSignalHandlers() + 112
2  swift-ide-test           0x0000000107a054f4 SignalHandler(int, __siginfo*, void*) + 296
3  libsystem_platform.dylib 0x0000000182672744 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001826688cc pthread_kill + 296
5  libsystem_c.dylib        0x000000018256f7ac abort + 124
6  libsystem_c.dylib        0x000000018256ea38 err + 0
7  swift-ide-test           0x0000000107a14770 swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) (.cold.3) + 0
8  swift-ide-test           0x00000001026dbbe0 swift::GenericEnvironment::mapTypeIntoContext(swift::Type) const + 0
9  swift-ide-test           0x00000001028fb234 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing(swift::SourceFile*) + 2904
10 swift-ide-test           0x0000000103b54100 swift::Parser::performIDEInspectionSecondPassImpl(swift::IDEInspectionDelayedDeclState&) + 596
11 swift-ide-test           0x0000000103b53db4 swift::IDEInspectionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::IDEInspectionCallbacksFactory*) const + 224
12 swift-ide-test           0x0000000103b59438 swift::IDEInspectionSecondPassRequest::OutputType swift::Evaluator::getResultUncached<swift::IDEInspectionSecondPassRequest, swift::IDEInspectionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::IDEInspectionSecondPassRequest>(swift::Evaluator&, swift::IDEInspectionSecondPassRequest, swift::IDEInspectionSecondPassRequest::OutputType)::'lambda'()>(swift::IDEInspectionSecondPassRequest const&, swift::IDEInspectionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::IDEInspectionSecondPassRequest>(swift::Evaluator&, swift::IDEInspectionSecondPassRequest, swift::IDEInspectionSecondPassRequest::OutputType)::'lambda'()) + 232
13 swift-ide-test           0x0000000103b53cc4 swift::performIDEInspectionSecondPass(swift::SourceFile&, swift::IDEInspectionCallbacksFactory&) + 52
14 swift-ide-test           0x000000010297cd50 void llvm::function_ref<void (swift::ide::IDEInspectionInstanceResult const&, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>)>::callback_fn<swift::ide::IDEInspectionInstance::codeComplete(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, swift::ide::CodeCompletionContext&, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>)::$_0::operator()(swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>) const::'lambda'(auto&, auto)>(long, swift::ide::IDEInspectionInstanceResult const&, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>) + 896
15 swift-ide-test           0x000000010297c338 void swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>::mapAsync<swift::ide::CodeCompleteResult>(llvm::function_ref<void (swift::ide::IDEInspectionInstanceResult const&, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>)>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>) + 84
16 swift-ide-test           0x000000010297c280 void llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>)>::callback_fn<swift::ide::IDEInspectionInstance::codeComplete(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, swift::ide::CodeCompletionContext&, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>)::$_0>(long, swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>) + 128
17 swift-ide-test           0x000000010297b4f8 swift::ide::IDEInspectionInstance::performNewOperation(std::__1::optional<llvm::hash_code>, swift::CompilerInvocation&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>)>) + 804
18 swift-ide-test           0x000000010297bc84 swift::ide::IDEInspectionInstance::performOperation(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>)>) + 552
19 swift-ide-test           0x000000010297bec4 swift::ide::IDEInspectionInstance::codeComplete(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, swift::ide::CodeCompletionContext&, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>) + 216
20 swift-ide-test           0x000000010240df8c bool llvm::function_ref<bool (CompletionLikeOperationParams)>::callback_fn<doCodeCompletion(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, CompletionLikeOperationParams) + 340
21 swift-ide-test           0x000000010240dc64 performWithCompletionLikeOperationParams(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, llvm::function_ref<bool (CompletionLikeOperationParams)>) + 1288
22 swift-ide-test           0x00000001023fa160 doCodeCompletion(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, bool, bool) + 444
23 swift-ide-test           0x00000001023f5894 main + 11264
24 dyld                     0x00000001822b1c84 start + 7040

Metadata

Metadata

Assignees

Labels

assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completioncrashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions