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-8396] Assertion hit in code completion after argument label #50922

Closed
nathawes opened this issue Jul 28, 2018 · 4 comments
Closed

[SR-8396] Assertion hit in code completion after argument label #50922

nathawes opened this issue Jul 28, 2018 · 4 comments
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 regression source tooling Area: IDE support, SourceKit, and other source tooling swift 5.0

Comments

@nathawes
Copy link
Collaborator

nathawes commented Jul 28, 2018

Previous ID SR-8396
Radar rdar://problem/42678836
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, 5.0Regression, CompilerCrash
Assignee @nathawes
Priority Medium

md5: b18283e6d88fc9a73009136d61291936

Issue Description:

Reproducer:

 public func * (lhs: Int, rhs: Character) -> String {
  return String(repeating: String(rhs), count #^COMPLETE^#: lhs)
}
$ swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test.swift
found code completion token COMPLETE at offset 99  
found code completion token COMPLETE at offset 99  
Assertion failed: (idx \< size()), function operator\[\], file /Users/nathanhawes/workspace/open-swift-source-compat-suite/llvm/include/llvm/ADT/SmallVector.h, line 149.  
0 swift-ide-test 0x000000010eb8da98 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40  
1 swift-ide-test 0x000000010eb8ca06 llvm::sys::RunSignalHandlers() + 198  
2 swift-ide-test 0x000000010eb8e0b2 SignalHandler(int) + 258  
3 libsystem_platform.dylib 0x00007fff7dd65f5a \_sigtramp + 26  
4 libsystem_platform.dylib 0x00007f83e0600000 \_sigtramp + 1653186752  
5 libsystem_c.dylib 0x00007fff7db0f1ae abort + 127  
6 libsystem_c.dylib 0x00007fff7dad71ac basename_r + 0  
7 swift-ide-test 0x000000010b89502b swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 6075  
8 swift-ide-test 0x000000010b898fed swift::constraints::DisjunctionChoice::solve(llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 61  
9 swift-ide-test 0x000000010b898a93 swift::constraints::ConstraintSystem::solveForDisjunctionChoices(swift::constraints::Constraint\*, llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 2067  
10 swift-ide-test 0x000000010b89769b swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 171  
11 swift-ide-test 0x000000010b893abd swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 589  
12 swift-ide-test 0x000000010b839319 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::Expr\*) + 297  
13 swift-ide-test 0x000000010b896ea5 swift::constraints::ConstraintSystem::solve(swift::Expr\*&, swift::Type, swift::ExprTypeCheckListener\*, llvm::SmallVectorImpl\<swift::constraints::Solution\>&, swift::FreeTypeVariableBinding) + 69  
14 swift-ide-test 0x000000010b9301c7 swift::TypeChecker::typeCheckExpression(swift::Expr\*&, swift::DeclContext\*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet\<swift::TypeCheckExprFlags, unsigned int\>, swift::ExprTypeCheckListener\*, swift::constraints::ConstraintSystem\*) + 855  
15 swift-ide-test 0x000000010b9c0cfc swift::ASTVisitor\<(anonymous namespace)::StmtChecker, void, swift::Stmt\*, void, void, void, void\>::visit(swift::Stmt\*) + 8764  
16 swift-ide-test 0x000000010b9bec0c swift::ASTVisitor\<(anonymous namespace)::StmtChecker, void, swift::Stmt\*, void, void, void, void\>::visit(swift::Stmt\*) + 332  
17 swift-ide-test 0x000000010b9bdd85 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt\*&) + 85  
18 swift-ide-test 0x000000010b9bd1d0 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl\*, swift::SourceLoc) + 288  
19 swift-ide-test 0x000000010b9e0d18 swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl\*, swift::SourceLoc) + 1192  
20 swift-ide-test 0x000000010b610afc (anonymous namespace)::CodeCompletionCallbacksImpl::typeCheckContext(swift::DeclContext\*) + 188  
21 swift-ide-test 0x000000010b60aa82 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 2706  
22 swift-ide-test 0x000000010bb05130 (anonymous namespace)::ParseDelayedFunctionBodies::walkToDeclPre(swift::Decl\*) + 304  
23 swift-ide-test 0x000000010bbbf22b (anonymous namespace)::Traversal::doIt(swift::Decl\*) + 171  
24 swift-ide-test 0x000000010bbbf16b swift::Decl::walk(swift::ASTWalker&) + 27  
25 swift-ide-test 0x000000010bc7929a swift::SourceFile::walk(swift::ASTWalker&) + 170  
26 swift-ide-test 0x000000010bc77baf swift::ModuleDecl::walk(swift::ASTWalker&) + 95  
27 swift-ide-test 0x000000010bafe257 swift::performDelayedParsing(swift::DeclContext\*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory\*) + 215  
28 swift-ide-test 0x000000010b5f23c9 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 1081  
29 swift-ide-test 0x000000010b5f1650 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 512  
30 swift-ide-test 0x000000010b5762c8 main + 29032  
31 libdyld.dylib 0x00007fff7da63015 start + 1  
32 libdyld.dylib 0x0000000000000005 start + 2186924017  
Stack dump:  
0. Program arguments: build/compat_macos/swift-macosx-x86_64/bin/swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test.swift  
1. While walking into decl '\*(*:*🙂' at /tmp/test.swift:1:8  
2. While type-checking statement at \[/tmp/test.swift:1:52 - line:3:1\] RangeText="{  
return String(repeating: String(rhs), count : lhs)  
}"  
3. While type-checking statement at \[/tmp/test.swift:2:3 - line:2:53\] RangeText="return String(repeating: String(rhs), count : lhs)"  
4. While type-checking expression at \[/tmp/test.swift:2:10 - line:2:53\] RangeText="String(repeating: String(rhs), count : lhs)"  
Abort trap: 6
@nathawes
Copy link
Collaborator Author

@swift-ci create

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 6, 2018

Reproduced with compiler (only on master branch):

func test(chr: Character) {
  _ = String(repeating: String(chr))
}

CC: @xedin

@xedin
Copy link
Member

xedin commented Aug 6, 2018

It looks like this is something new because even in debug build it's still `solveRec`, I haven't seen failures like that for a while now...

@xedin
Copy link
Member

xedin commented Aug 7, 2018

PR #18527 has been merged into master

@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 regression source tooling Area: IDE support, SourceKit, and other source tooling swift 5.0
Projects
None yet
Development

No branches or pull requests

3 participants