Skip to content

Assertion failed: (!bool(ActiveChoice)), function ~ConjunctionStep, file CSStep.h, line 967 #63455

@ahoppen

Description

@ahoppen

The following new test case crashes with an assertion failure:

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

func sheet(onDismiss: () -> Void) -> EmptyView {
  fatalError()
}

@resultBuilder struct ViewBuilder2 {
  static func buildBlock(_ content: EmptyView) -> EmptyView {
    return content
  }
}

struct EmptyView {}

struct SettingsView {
  var importedFile: Int?

  @ViewBuilder2 var body2: EmptyView {
    sheet {
      #^COMPLETE^#if let url = self.importedFile {
        print(url)
      }
    }
  }
}

Stack trace.

found code completion token COMPLETE at offset 412
Assertion failed: (!bool(ActiveChoice)), function ~ConjunctionStep, file CSStep.h, line 967.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
(decl_context: )(decl_context: )Stack dump:
0.	Program arguments: /Users/alex/swift-src/mbuild/Release+Asserts/swift-macosx-x86_64/bin/swift-ide-test -module-cache-path /Users/alex/swift-src/mbuild/Release+Asserts/swift-macosx-x86_64/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -completion-cache-path /Users/alex/swift-src/mbuild/Release+Asserts/swift-macosx-x86_64/swift-test-results/x86_64-apple-macosx10.9/completion-cache -swift-version 4 -resource-dir /Users/alex/swift-src/mbuild/Release+Asserts/swift-macosx-x86_64/lib/swift -code-completion -source-filename /Users/alex/swift-src/swift/test/test.swift -code-completion-token COMPLETE
1.	While performing new IDE inspection
2.	While evaluating request IDEInspectionSecondPassRequest(source_file "/Users/alex/swift-src/swift/test/test.swift", )
3.	While evaluating request TypeCheckASTNodeAtLocRequest(0x7fed61869b10 AbstractClosureExpr line=19 : <null>, )
4.	While evaluating request TypeCheckASTNodeAtLocRequest(0x7fed618697b0 AbstractFunctionDecl name=_ : (no type set), )
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           0x0000000106db9a47 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-ide-test           0x0000000106db8948 llvm::sys::RunSignalHandlers() + 248
2  swift-ide-test           0x0000000106dba090 SignalHandler(int) + 272
3  libsystem_platform.dylib 0x00007ff817ecac1d _sigtramp + 29
4  libsystem_platform.dylib 0x00006000028bffff _sigtramp + 18446708923338544127
5  libsystem_c.dylib        0x00007ff817de9ca5 abort + 123
6  libsystem_c.dylib        0x00007ff817de8fbe err + 0
7  swift-ide-test           0x000000010193afb3 swift::constraints::ConjunctionStep::~ConjunctionStep() (.cold.1) + 35
8  swift-ide-test           0x0000000101934d91 swift::constraints::ConjunctionStep::~ConjunctionStep() + 689
9  swift-ide-test           0x000000010193334e swift::constraints::ConjunctionStep::~ConjunctionStep() + 14
10 swift-ide-test           0x000000010191538f swift::constraints::ConstraintSystem::solveImpl(llvm::SmallVectorImpl<swift::constraints::Solution>&) + 959
11 swift-ide-test           0x0000000101917c73 swift::constraints::ConstraintSystem::solveForCodeCompletion(llvm::SmallVectorImpl<swift::constraints::Solution>&) + 67
12 swift-ide-test           0x00000001018049f0 swift::TypeChecker::applyResultBuilderBodyTransform(swift::FuncDecl*, swift::Type, bool) + 1088
13 swift-ide-test           0x0000000101c149f6 swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::TypeCheckASTNodeAtLocContext, swift::SourceLoc) const + 534
14 swift-ide-test           0x0000000101c704f3 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 243
15 swift-ide-test           0x0000000101c66dab swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 27
16 swift-ide-test           0x0000000101c66d70 swift::typeCheckASTNodeAtLoc(swift::TypeCheckASTNodeAtLocContext, swift::SourceLoc) + 96
17 swift-ide-test           0x0000000101c14b22 swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::TypeCheckASTNodeAtLocContext, swift::SourceLoc) const + 834
18 swift-ide-test           0x0000000101c704f3 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 243
19 swift-ide-test           0x0000000101c66dab swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 27
20 swift-ide-test           0x0000000101c66d70 swift::typeCheckASTNodeAtLoc(swift::TypeCheckASTNodeAtLocContext, swift::SourceLoc) + 96
21 swift-ide-test           0x00000001007831d2 swift::ide::typeCheckContextAt(swift::TypeCheckASTNodeAtLocContext, swift::SourceLoc) + 418
22 swift-ide-test           0x000000010074d46b (anonymous namespace)::CodeCompletionCallbacksImpl::trySolverCompletion(bool)::$_19::operator()(swift::ide::TypeCheckCompletionCallback&) const + 139
23 swift-ide-test           0x000000010074665e (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing(swift::SourceFile*) + 430
24 swift-ide-test           0x0000000101f5d5c4 swift::Parser::performIDEInspectionSecondPassImpl(swift::IDEInspectionDelayedDeclState&) + 692
25 swift-ide-test           0x0000000101f5d275 swift::IDEInspectionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::IDEInspectionCallbacksFactory*) const + 165
26 swift-ide-test           0x0000000101f64c0f llvm::Expected<swift::IDEInspectionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::IDEInspectionSecondPassRequest>(swift::IDEInspectionSecondPassRequest const&) + 271
27 swift-ide-test           0x0000000101f5d0f6 swift::IDEInspectionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::IDEInspectionSecondPassRequest>(swift::Evaluator&, swift::IDEInspectionSecondPassRequest, swift::IDEInspectionSecondPassRequest::OutputType) + 38
28 swift-ide-test           0x00000001007f848d void llvm::function_ref<void (swift::ide::IDEInspectionInstanceResult&, 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>)>)::$_1::operator()(swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>) const::'lambda'(auto&, auto)>(long, swift::ide::IDEInspectionInstanceResult&, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>) + 1165
29 swift-ide-test           0x00000001007f79c9 void swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>::mapAsync<swift::ide::CodeCompleteResult>(llvm::function_ref<void (swift::ide::IDEInspectionInstanceResult&, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>)>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::CodeCompleteResult>)>) + 89
30 swift-ide-test           0x00000001007f791c 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>)>)::$_1>(long, swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>) + 140
31 swift-ide-test           0x00000001007f661b llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>)>::operator()(swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>) const + 107
32 swift-ide-test           0x00000001007f6c69 swift::ide::IDEInspectionInstance::performNewOperation(llvm::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>)>) + 1017
33 swift-ide-test           0x00000001007f73f9 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>)>) + 585
34 swift-ide-test           0x00000001007f75db 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>)>) + 139
35 swift-ide-test           0x00000001001bef9b 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, bool)::$_7>(long, CompletionLikeOperationParams) + 283
36 swift-ide-test           0x00000001001bed0b performWithCompletionLikeOperationParams(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, llvm::function_ref<bool (CompletionLikeOperationParams)>) + 1067
37 swift-ide-test           0x00000001001af001 doCodeCompletion(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, bool, bool, bool) + 593
38 swift-ide-test           0x00000001001a9407 main + 10727
39 dyld                     0x00007ff817b6f310 start + 2432

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completioncompilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarefound by stress testerFlag: An issue found by the SourceKit stress testersource toolingArea: IDE support, SourceKit, and other source toolingswift 5.9type checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions