Navigation Menu

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-14891] Assertion failure (hasType(KP, I) && "Expected type to have been set!") when completing in key path #57238

Closed
ahoppen opened this issue Jul 7, 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 Jul 7, 2021

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

md5: 6250998c184c0227e45f14f4e478c740

Issue Description:

The following test case causes in assertion failure

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

func foo() {
    [1].map(\.self#^COMPLETE^#)
}

Stack trace:

Stack dump:
0.  Program arguments: /Users/alex/swift-src/nbuild/Release+Asserts/bin/swift-ide-test -target x86_64-apple-macosx10.9 -resource-dir /Users/alex/swift-src/nbuild/Release+Asserts/lib/swift -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
1.  While performing new completion
2.  While evaluating request CodeCompletionSecondPassRequest(source_file "/Users/alex/swift-src/swift/test/SourceKit/test.swift", )
3.  While evaluating request TypeCheckASTNodeAtLocRequest(0x7f87b58f1f20 AbstractFunctionDecl name=foo() : (no type set), )
4.  While type-checking expression at [/Users/alex/swift-src/swift/test/SourceKit/test.swift:4:5 - line:4:20] RangeText="[1].map(\.self"
5.  While code-completion expression at [/Users/alex/swift-src/swift/test/SourceKit/test.swift:4:5 - line:4:20] RangeText="[1].map(\.self"
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           0x000000010553fa67 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-ide-test           0x000000010553e968 llvm::sys::RunSignalHandlers() + 248
2  swift-ide-test           0x0000000105540096 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff20552d7d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339973710496
5  libsystem_c.dylib        0x00007fff20462411 abort + 120
6  libsystem_c.dylib        0x00007fff204617e8 err + 0
7  swift-ide-test           0x0000000105a79143 swift::constraints::ConstraintSystem::getType(swift::KeyPathExpr const*, unsigned int) const (.cold.2) + 35
8  swift-ide-test           0x00000001019ed96b swift::constraints::ConstraintSystem::getType(swift::KeyPathExpr const*, unsigned int) const + 203
9  swift-ide-test           0x00000001019ed6ce swift::KeyPathTypeCheckCompletionCallback::sawSolution(swift::constraints::Solution const&) + 142
10 swift-ide-test           0x00000001019ebeb9 swift::TypeChecker::typeCheckForCodeCompletion(swift::constraints::SolutionApplicationTarget&, bool, llvm::function_ref<void (swift::constraints::Solution const&)>)::$_2::operator()(swift::constraints::SolutionApplicationTarget&) const + 1465
11 swift-ide-test           0x00000001019eb7b6 swift::TypeChecker::typeCheckForCodeCompletion(swift::constraints::SolutionApplicationTarget&, bool, llvm::function_ref<void (swift::constraints::Solution const&)>) + 838
12 swift-ide-test           0x0000000101a003c1 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 305
13 swift-ide-test           0x0000000101a0020e swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::constraints::ContextualTypeInfo, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 78
14 swift-ide-test           0x0000000101ac6a54 (anonymous namespace)::StmtChecker::typeCheckASTNode(swift::ASTNode&) + 244
15 swift-ide-test           0x0000000101ac6e3e swift::TypeCheckASTNodeAtLocRequest::evaluate(swift::Evaluator&, swift::DeclContext*, swift::SourceLoc) const + 542
16 swift-ide-test           0x0000000101b047a3 llvm::Expected<swift::TypeCheckASTNodeAtLocRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckASTNodeAtLocRequest>(swift::TypeCheckASTNodeAtLocRequest const&) + 243
17 swift-ide-test           0x0000000101afe5e7 swift::TypeCheckASTNodeAtLocRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckASTNodeAtLocRequest>(swift::Evaluator&, swift::TypeCheckASTNodeAtLocRequest, swift::TypeCheckASTNodeAtLocRequest::OutputType) + 55
18 swift-ide-test           0x0000000101afe591 swift::typeCheckASTNodeAtLoc(swift::DeclContext*, swift::SourceLoc) + 65
19 swift-ide-test           0x0000000100e6b523 swift::ide::typeCheckContextAt(swift::DeclContext*, swift::SourceLoc) + 771
20 swift-ide-test           0x0000000100e43cf6 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 854
21 swift-ide-test           0x0000000101d741e8 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 888
22 swift-ide-test           0x0000000101d73d68 swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 232
23 swift-ide-test           0x0000000101d7e46f llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 271
24 swift-ide-test           0x0000000101d73b77 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 55
25 swift-ide-test           0x0000000100e69701 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
26 swift-ide-test           0x0000000100e69b98 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
27 swift-ide-test           0x0000000100a674d0 doCodeCompletionImpl(swift::CodeCompletionCallbacksFactory*, swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool) + 1376
28 swift-ide-test           0x0000000100a59e00 main + 26192
29 libdyld.dylib            0x00007fff20528f5d start + 1
/Users/alex/swift-src/nbuild/Release+Asserts/tools/swift/test-macosx-x86_64/SourceKit/Output/test.swift.script: line 1: 34714 Abort trap: 6           xcrun --toolchain XcodeDefault --sdk '/Applications/Xcode-Customer.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk' /Users/alex/swift-src/nbuild/Release+Asserts/bin/swift-ide-test -target x86_64-apple-macosx10.9 -resource-dir /Users/alex/swift-src/nbuild/Release+Asserts/lib/swift -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
@ahoppen
Copy link
Contributor Author

ahoppen commented Jul 8, 2021

@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