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-10924] Compiler crash on misplaced @escaping #53315

Closed
hamishknight opened this issue Jun 12, 2019 · 2 comments
Closed

[SR-10924] Compiler crash on misplaced @escaping #53315

hamishknight opened this issue Jun 12, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-10924
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.1-dev (LLVM 606965a6c8, Swift cae2eba999)
Target: x86_64-apple-darwin18.5.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee None
Priority Medium

md5: 534fb1ffbb21182bcdba65dab6b6227a

Issue Description:

The following trips an assertion on diagnosis:

func foo() -> () -> (@escaping ()) -> Void { { {} } }

Stack trace:

Assertion failed: (Loc.isValid()), function getLineNumber, file /Users/hamishknight/Desktop/swift-dev/swift/include/swift/Basic/SourceManager.h, line 209.
Stack dump:
0.  Program arguments: ./swift -frontend -typecheck /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
1.  Swift version 5.1-dev (LLVM 606965a6c8, Swift cae2eba999)
2.  While type-checking 'foo()' (at /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:204:1)
3.  While type-checking statement at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:204:51 - line:204:60] RangeText="{ { {} } "
4.  While type-checking statement at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:204:53 - line:204:58] RangeText="{ {} "
5.  While type-checking expression at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:204:53 - line:204:58] RangeText="{ {} "
0  swift                    0x000000010de83e75 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010de82e78 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x000000010de84478 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff5e9e4b5d _sigtramp + 29
4  libsystem_platform.dylib 0x00000001116e8938 _sigtramp + 2999991800
5  libsystem_c.dylib        0x00007fff5e8a46a6 abort + 127
6  libsystem_c.dylib        0x00007fff5e86d20d basename_r + 0
7  swift                    0x000000010e18e7f3 swift::constraints::ClosureParamDestructuringFailure::diagnoseAsError() (.cold.3) + 35
8  swift                    0x000000010aa88c02 swift::constraints::ClosureParamDestructuringFailure::diagnoseAsError() + 4082
9  swift                    0x000000010aa7a830 swift::constraints::AllowClosureParamDestructuring::diagnose(swift::Expr*, bool) const + 112
10 swift                    0x000000010a9e5cbb swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::$_12::operator()(swift::Expr*) const + 203
11 swift                    0x000000010aa04161 swift::Expr* llvm::function_ref<swift::Expr* (swift::Expr*)>::callback_fn<swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::$_13>(long, swift::Expr*) + 33
12 swift                    0x000000010ae907be swift::Expr::forEachChildExpr(llvm::function_ref<swift::Expr* (swift::Expr*)>)::ChildWalker::walkToExprPre(swift::Expr*) + 14
13 swift                    0x000000010ae1687c swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 7340
14 swift                    0x000000010ae14641 swift::Expr::walk(swift::ASTWalker&) + 81
15 swift                    0x000000010ae87013 swift::Expr::forEachChildExpr(llvm::function_ref<swift::Expr* (swift::Expr*)>) + 51
16 swift                    0x000000010a9e5b24 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&) + 532
17 swift                    0x000000010a9e5ded swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 141
18 swift                    0x000000010ab2081f swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 1071
19 swift                    0x000000010ab203df swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 63
20 swift                    0x000000010abbaf0e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 10542
21 swift                    0x000000010abbbb48 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::Stmt>(swift::Stmt*&) + 136
22 swift                    0x000000010abb86e9 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 265
23 swift                    0x000000010abb7968 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
24 swift                    0x000000010abb659d swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 493
25 swift                    0x000000010abb70ae swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 334
26 swift                    0x000000010abd7547 typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 247
27 swift                    0x000000010abd7ced swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1005
28 swift                    0x000000010a390846 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 502
29 swift                    0x000000010a38f656 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 342
30 swift                    0x000000010a38effa swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 618
31 swift                    0x000000010a17ed72 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1730
32 swift                    0x000000010a17d6d1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3025
33 swift                    0x000000010a126c49 main + 729
34 libdyld.dylib            0x00007fff5e7ff3d5 start + 1
fish: './swift -frontend -typecheck /U…' terminated by signal SIGABRT (Abort)
@belkadan
Copy link
Contributor

cc @xedin, @rintaro

@hamishknight
Copy link
Collaborator Author

Fixed by #25638

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants