-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionArea → source tooling: code completioncompilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarefound by stress testerFlag: An issue found by the SourceKit stress testerFlag: An issue found by the SourceKit stress testersource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source tooling
Description
Previous ID | SR-13877 |
Radar | rdar://problem/71566576 |
Original Reporter | @nathawes |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | CodeCompletion |
Labels | Bug, Crash, FoundByStressTester |
Assignee | @ahoppen |
Priority | Medium |
md5: 372bbc8a2102b525b524a82317e4e40f
Issue Description:
Reproducer on main:
$ cat /tmp/test.swift
if let item = ["a"].first(where: { #^COMPLETE^# }) {}
$ swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test.swift
found code completion token COMPLETE at offset 35
found code completion token COMPLETE at offset 35
Assertion failed: (!elt.getPattern()->hasType() && "the pattern binding condition is already type checked"), function typeCheckConditionForStatement, file swift/lib/Sema/TypeCheckStmt.cpp, line 516.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: ../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test.swift
1. While performing new completion
2. While evaluating request CodeCompletionSecondPassRequest(source_file "/tmp/test.swift", )
3. While evaluating request TypeCheckASTNodeAtLocRequest(0x7fd95306da60 TopLevelCodeDecl line=1, )
4. While type-checking statement at [/tmp/test.swift:1:1 - line:1:39] RangeText="if let item = ["a"].first(where: { }"
0 swift-ide-test 0x00000001112114fa llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 58
1 swift-ide-test 0x0000000111211a49 PrintStackTraceSignalHandler(void*) + 25
2 swift-ide-test 0x000000011120f9bb llvm::sys::RunSignalHandlers() + 123
3 swift-ide-test 0x00000001112137f9 SignalHandler(int) + 249
4 libsystem_platform.dylib 0x00007fff20369d7d _sigtramp + 29
5 libsystem_platform.dylib 0x000000000003c388 _sigtramp + 18446603339975960104
6 libsystem_c.dylib 0x00007fff20278720 abort + 120
7 libsystem_c.dylib 0x00007fff202779d6 err + 0
8 swift-ide-test 0x0000000108e7b931 typeCheckConditionForStatement(swift::LabeledConditionalStmt*, swift::DeclContext*) + 961
9 swift-ide-test 0x0000000108e797f8 (anonymous namespace)::StmtChecker::visitIfStmt(swift::IfStmt*) + 40
10 swift-ide-test 0x0000000108e78209 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 201
11 swift-ide-test 0x0000000108e77f21 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::Stmt>(swift::Stmt*&) + 161
12 swift-ide-test 0x0000000108e7156f (anonymous namespace)::StmtChecker::typeCheckASTNode(swift::ASTNode&) + 847
13 swift-ide-test 0x0000000108e711e8 swift::TypeChecker::typeCheckASTNode(swift::ASTNode&, swift::DeclContext*, bool) + 56
14 swift-ide-test 0x0000000108e7199c swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::DeclContext*, swift::SourceLoc) const + 940
15 swift-ide-test 0x0000000108e67b41 bool swift::SimpleRequest<swift::TypeCheckASTNodeAtLocRequest, bool (swift::DeclContext*, swift::SourceLoc), (swift::RequestFlags)1>::callDerived<0ul, 1ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) const + 97
16 swift-ide-test 0x0000000108e63ea0 swift::SimpleRequest<swift::TypeCheckASTNodeAtLocRequest, bool (swift::DeclContext*, swift::SourceLoc), (swift::RequestFlags)1>::evaluateRequest(swift::TypeCheckASTNodeAtLocRequest const&, swift::Evaluator&) + 32
17 swift-ide-test 0x0000000108f1a806 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 406
18 swift-ide-test 0x0000000108f1a5d0 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckASTNodeAtLocRequest, (void*)0>(swift::TypeCheckASTNodeAtLocRequest const&) + 96
19 swift-ide-test 0x0000000108efebf9 swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 57
20 swift-ide-test 0x0000000108efeba3 swift::typeCheckASTNodeAtLoc(swift::DeclContext*, swift::SourceLoc) + 99
21 swift-ide-test 0x0000000106ef94cc swift::ide::collectPossibleReturnTypesFromContext(swift::DeclContext*, llvm::SmallVectorImpl<swift::Type>&) + 364
22 swift-ide-test 0x0000000106efeb26 (anonymous namespace)::ExprContextAnalyzer::analyzeExpr(swift::Expr*) + 3126
23 swift-ide-test 0x0000000106ef9d7b (anonymous namespace)::ExprContextAnalyzer::Analyze() + 443
24 swift-ide-test 0x0000000106ef9b22 swift::ide::ExprContextInfo::ExprContextInfo(swift::DeclContext*, swift::Expr*) + 226
25 swift-ide-test 0x0000000106ef9a35 swift::ide::ExprContextInfo::ExprContextInfo(swift::DeclContext*, swift::Expr*) + 37
26 swift-ide-test 0x0000000106e9a6a5 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 3093
27 swift-ide-test 0x00000001094936ab swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 1323
28 swift-ide-test 0x0000000109492e48 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 376
29 swift-ide-test 0x00000001094cd079 bool swift::SimpleRequest<swift::CodeCompletionSecondPassRequest, bool (swift::SourceFile*, swift::CodeCompletionCallbacksFactory*), (swift::RequestFlags)9>::callDerived<0ul, 1ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) const + 89
30 swift-ide-test 0x00000001094ccf60 swift::SimpleRequest<swift::CodeCompletionSecondPassRequest, bool (swift::SourceFile*, swift::CodeCompletionCallbacksFactory*), (swift::RequestFlags)9>::evaluateRequest(swift::CodeCompletionSecondPassRequest const&, swift::Evaluator&) + 32
31 swift-ide-test 0x00000001094af6d6 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 406
32 swift-ide-test 0x00000001094af480 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::operator()<swift::CodeCompletionSecondPassRequest, (void*)0>(swift::CodeCompletionSecondPassRequest const&) + 96
33 swift-ide-test 0x0000000109492bc9 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 57
34 swift-ide-test 0x0000000109492b80 swift::performCodeCompletionSecondPass(swift::SourceFile&, swift::CodeCompletionCallbacksFactory&) + 96
35 swift-ide-test 0x0000000106390e0d doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool)::$_0::operator()(swift::CompilerInstance&, bool) const + 141
36 swift-ide-test 0x0000000106390d6c void llvm::function_ref<void (swift::CompilerInstance&, bool)>::callback_fn<doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool)::$_0>(long, swift::CompilerInstance&, bool) + 76
37 swift-ide-test 0x0000000106ee9998 llvm::function_ref<void (swift::CompilerInstance&, bool)>::operator()(swift::CompilerInstance&, bool) const + 88
38 swift-ide-test 0x0000000106ee9c7f 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)>) + 623
39 swift-ide-test 0x0000000106eea63e 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)>) + 670
40 swift-ide-test 0x0000000106390ad4 doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool) + 1076
41 swift-ide-test 0x0000000106366757 doCodeCompletion(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool) + 535
42 swift-ide-test 0x0000000106362858 main + 7720
43 libdyld.dylib 0x00007fff20340631 start + 1
Abort trap: 6
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionArea → source tooling: code completioncompilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarefound by stress testerFlag: An issue found by the SourceKit stress testerFlag: An issue found by the SourceKit stress testersource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source tooling