Swift: compiler crash
| Originator: | garth | ||
| Number: | rdar://22205747 | Date Originated: | 09-Aug-2015 12:49 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7 beta 5 |
| Classification: | Serious Bug | Reproducible: | Always |
This fragment crashes the compiler in a project or playground:
func crash(fooPart: String = "foo", @noescape closure: () -> String?) {}
crash(“a” + "b")
I know the signatures don’t match, but the compiler shouldn’t crash. Here’s a trace from a test project:
CompileSwift normal x86_64 /Users/garth/Library/Playgrounds/CrashProject/CrashProject/AppDelegate.swift
cd /Users/garth/Library/Playgrounds/CrashProject
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/garth/Library/Playgrounds/CrashProject/CrashProject/ViewController.swift /Users/garth/Library/Playgrounds/CrashProject/Crash.swift -primary-file /Users/garth/Library/Playgrounds/CrashProject/CrashProject/AppDelegate.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -I /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator -F /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/garth/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-generated-files.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-own-target-headers.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-all-target-headers.hmap -Xcc -iquote -Xcc /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-project-headers.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/DerivedSources/x86_64 -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/garth/Library/Playgrounds/CrashProject -emit-module-doc-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc -Onone -module-name CrashProject -emit-module-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.dia -emit-dependencies-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.d -emit-reference-dependencies-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.swiftdeps -o /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.o
Assertion failed: (!failed && "Call arguments did not match up?"), function coerceCallArguments, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.52.2/src/swift/lib/Sema/CSApply.cpp, line 4085.
0 swift 0x000000010ed36bbb llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x000000010ed372fb SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff9271cf1a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff52f0af80 _sigtramp + 3229540480
4 libsystem_c.dylib 0x00007fff886809b3 abort + 129
5 libsystem_c.dylib 0x00007fff88648a99 basename + 0
6 swift 0x000000010d3202df (anonymous namespace)::ExprRewriter::coerceCallArguments(swift::Expr*, swift::Type, swift::constraints::ConstraintLocatorBuilder) + 5951
7 swift 0x000000010d311878 (anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr*, swift::Type, swift::constraints::ConstraintLocatorBuilder) + 728
8 swift 0x000000010d31843e swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) + 6622
9 swift 0x000000010d313616 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) + 22
10 swift 0x000000010d45b00c swift::Expr::walk(swift::ASTWalker&) + 76
11 swift 0x000000010d307f7a swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 442
12 swift 0x000000010d3985b0 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::Type, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 624
13 swift 0x000000010d3fc41a swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 490
14 swift 0x000000010d3fb789 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
15 swift 0x000000010d3fa84f swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 415
16 swift 0x000000010d3fa661 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 49
17 swift 0x000000010d3fb38a swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 138
18 swift 0x000000010d38067c typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 220
19 swift 0x000000010d3814a9 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1913
20 swift 0x000000010d187cf5 swift::CompilerInstance::performSema() + 4357
21 swift 0x000000010ccf750c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 748
22 swift 0x000000010ccf6fc8 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2728
23 swift 0x000000010ccf302f main + 2015
24 libdyld.dylib 0x00007fff8925d5c9 start + 1
25 libdyld.dylib 0x000000000000003c start + 1994009204
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/garth/Library/Playgrounds/CrashProject/CrashProject/ViewController.swift /Users/garth/Library/Playgrounds/CrashProject/Crash.swift -primary-file /Users/garth/Library/Playgrounds/CrashProject/CrashProject/AppDelegate.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -I /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator -F /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/garth/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-generated-files.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-own-target-headers.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-all-target-headers.hmap -Xcc -iquote -Xcc /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/CrashProject-project-headers.hmap -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/DerivedSources/x86_64 -Xcc -I/Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/garth/Library/Playgrounds/CrashProject -emit-module-doc-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc -Onone -module-name CrashProject -emit-module-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.dia -emit-dependencies-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.d -emit-reference-dependencies-path /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.swiftdeps -o /Users/garth/Library/Developer/Xcode/DerivedData/CrashProject-bnjcqkfgrzrcotekncrjohmfkkav/Build/Intermediates/CrashProject.build/Debug-iphonesimulator/CrashProject.build/Objects-normal/x86_64/AppDelegate.o
1. While type-checking 'application' at /Users/garth/Library/Playgrounds/CrashProject/CrashProject/AppDelegate.swift:17:5
2. While type-checking expression at [/Users/garth/Library/Playgrounds/CrashProject/CrashProject/AppDelegate.swift:21:9 - line:21:43] RangeText="info("first part " + "second part")"
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!