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-14704] Unreachable "other AutoClosureExpr must be handled specially" hit during code completion in result builder #57054

Closed
ahoppen opened this issue Jun 2, 2021 · 1 comment
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

@ahoppen
Copy link
Contributor

ahoppen commented Jun 2, 2021

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

md5: f8013be6fc66774e289d9eb090730aef

Issue Description:

The following test case hits an llvm_unreachable("other AutoClosureExpr must be handled specially")

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

@resultBuilder struct ViewBuilder2 {
  static func buildBlock() -> Never { fatalError() }
  static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
}

protocol View2 {}

extension View2 {
  func qadding(_ edges: Set2) -> some View2 { fatalError() }
  func pnAppear(perform action: (() -> Void)? = nil) -> some View2 { fatalError() }
}

struct EmptyView2: View2 {}

struct Set2 {
  static let bottom = Set2()
}


struct AdaptsToSoftwareKeyboard {

  @ViewBuilder2 func body(content: EmptyView2) -> some View2 {
      content
            .qadding(.#^COMPLETE^#bottom)
            .pnAppear(perform: subscribeToKeyboardEvents)
    }

    private func subscribeToKeyboardEvents() {}
}

Stack trace:

other AutoClosureExpr must be handled specially
UNREACHABLE executed at /Users/alex/swift-src/swift/lib/Sema/TypeCheckCodeCompletion.cpp:193!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /Users/alex/swift-src/nbuild/Release+Asserts/bin/swift-ide-test -module-cache-path /Users/alex/swift-src/nbuild/Release+Asserts/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -completion-cache-path /Users/alex/swift-src/nbuild/Release+Asserts/swift-test-results/x86_64-apple-macosx10.9/completion-cache -swift-version 4 --code-completion --source-filename /Users/alex/swift-src/swift/test/SourceKit/test.swift --code-completion-token=COMPLETE -I /Users/alex/swift-src/swift/test/SourceKit/Inputs/Purchases.swiftinterface
1.  While performing new completion
2.  While evaluating request CodeCompletionSecondPassRequest(source_file "/Users/alex/swift-src/swift/test/SourceKit/test.swift", )
3.  While code-completion expression at [/Users/alex/swift-src/swift/test/SourceKit/test.swift:25:7 - line:27:57] RangeText="content
            .qadding(.bottom)
            .pnAppear(perform: subscribeToKeyboardEvents"
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           0x000000010d50fc67 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-ide-test           0x000000010d50ea88 llvm::sys::RunSignalHandlers() + 248
2  swift-ide-test           0x000000010d510296 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff20365d7d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339975729824
5  libsystem_c.dylib        0x00007fff20275411 abort + 120
6  swift-ide-test           0x000000010d46a452 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 482
7  swift-ide-test           0x00000001099c5c67 (anonymous namespace)::SanitizeExpr::walkToExprPre(swift::Expr*) + 1655
8  swift-ide-test           0x0000000108b5a9a4 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 84
9  swift-ide-test           0x0000000108b5b837 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 3815
10 swift-ide-test           0x0000000108b5cd82 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 210
11 swift-ide-test           0x0000000108b5a1f1 swift::Expr::walk(swift::ASTWalker&) + 81
12 swift-ide-test           0x00000001099c3470 swift::TypeChecker::typeCheckForCodeCompletion(swift::constraints::SolutionApplicationTarget&, bool, llvm::function_ref<void (swift::constraints::Solution const&)>) + 464
13 swift-ide-test           0x00000001099c49f6 swift::UnresolvedMemberTypeCheckCompletionCallback::fallbackTypeCheck(swift::DeclContext*) + 166
14 swift-ide-test           0x0000000108e345ba (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 874
15 swift-ide-test           0x0000000109d467c8 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 888
16 swift-ide-test           0x0000000109d46348 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 232
17 swift-ide-test           0x0000000109d50a1f llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 271
18 swift-ide-test           0x0000000109d46157 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 55
19 swift-ide-test           0x0000000108e59b01 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)>) + 529
20 swift-ide-test           0x0000000108e59f98 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)>) + 680
21 swift-ide-test           0x0000000108a6fac0 doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool) + 1376
22 swift-ide-test           0x0000000108a62560 main + 26144
23 libdyld.dylib            0x00007fff2033bf3d start + 1
@ahoppen
Copy link
Contributor Author

ahoppen commented Mar 17, 2022

Fixed by #41846

@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

2 participants