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-8042] swift-ide-test crash when querying completions for SwiftKeypath #50575

Closed
AnthonyLatsis opened this issue Jun 19, 2018 · 4 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software key paths Feature: key paths (both native and Objective-C) source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@AnthonyLatsis
Copy link
Collaborator

Previous ID SR-8042
Radar rdar://problem/41262612
Original Reporter @AnthonyLatsis
Type Bug
Status Closed
Resolution Done
Environment

Version 10.0 beta (10L176w)

Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, CompilerCrash, KeyPaths
Assignee @rintaro
Priority Medium

md5: d61b9c7f96c7dd424c22cfc87406d651

Issue Description:

Apart from this, we also don't have sensible completions without the dot.

struct Test {
  var foo = "swift"
}
let y: KeyPath<Test, String> = \.#^HERE^# // crash

Stack trace

found code completion token HERE at offset 196
found code completion token HERE at offset 196
found KeyPathDotExpr in CSGen
UNREACHABLE executed at /Volumes/Elements/swift-source/swift/lib/Sema/CSGen.cpp:2998!
0  swift-ide-test           0x000000010c96c878 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift-ide-test           0x000000010c96bae7 llvm::sys::RunSignalHandlers() + 39
2  swift-ide-test           0x000000010c96ce82 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff6deedf5a _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 2450596032
5  libsystem_c.dylib        0x00007fff6dc8b1ae abort + 127
6  swift-ide-test           0x000000010c90d730 LLVMInstallFatalErrorHandler + 0
7  swift-ide-test           0x000000010914b42e (anonymous namespace)::ConstraintGenerator::visitKeyPathDotExpr(swift::KeyPathDotExpr*) + 46
8  swift-ide-test           0x0000000109126c6a swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) + 2794
9  swift-ide-test           0x0000000109132f53 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 1363
10 swift-ide-test           0x0000000109a6ec26 (anonymous namespace)::Traversal::doIt(swift::Expr*) + 134
11 swift-ide-test           0x0000000109a6eb60 swift::Expr::walk(swift::ASTWalker&) + 64
12 swift-ide-test           0x00000001091256bd swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 269
13 swift-ide-test           0x0000000109196f05 swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 501
14 swift-ide-test           0x0000000109313c8e swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 174
15 swift-ide-test           0x000000010931643b swift::TypeChecker::getTypeOfExpressionWithoutApplying(swift::Expr*&, swift::DeclContext*, swift::ConcreteDeclRef&, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*) + 699
16 swift-ide-test           0x00000001094f2826 getTypeOfCompletionContextExpr(swift::TypeChecker&, swift::DeclContext*, swift::CompletionTypeCheckKind, swift::Expr*&, swift::ConcreteDeclRef&) + 310
17 swift-ide-test           0x00000001094f26aa swift::getTypeOfCompletionContextExpr(swift::ASTContext&, swift::DeclContext*, swift::CompletionTypeCheckKind, swift::Expr*&, swift::ConcreteDeclRef&) + 266
18 swift-ide-test           0x0000000108af5bec (anonymous namespace)::CodeCompletionCallbacksImpl::typeCheckParsedExpr() + 732
19 swift-ide-test           0x0000000108aee8d9 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 441
20 swift-ide-test           0x0000000109867036 (anonymous namespace)::parseDelayedDecl(swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 934
21 swift-ide-test           0x0000000109866bf5 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 245
22 swift-ide-test           0x0000000108a8e91d swift::CompilerInstance::parseAndCheckTypes(swift::CompilerInstance::ImplicitImports const&) + 1277
23 swift-ide-test           0x0000000108a8de4c swift::CompilerInstance::performSema() + 1900
24 swift-ide-test           0x00000001088fb644 doCodeCompletion(swift::CompilerInvocation const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, bool, bool, bool) + 2948
25 swift-ide-test           0x00000001088f3a8f main + 20959
26 libdyld.dylib            0x00007fff6dbdf015 start + 1
@belkadan
Copy link
Contributor

@swift-ci create

@rintaro
Copy link
Mannequin

rintaro mannequin commented Sep 26, 2018

#18884

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@AnthonyLatsis, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@AnthonyLatsis
Copy link
Collaborator Author

Fix confirmed. If anyone want to try, here's the command for the original example

$ ./your_build_dir/bin/swift-ide-test -code-completion -source-filename=your_file.swift -code-completion-token=HERE

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself labels Dec 12, 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 compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software key paths Feature: key paths (both native and Objective-C) source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

2 participants