Swift 2b5: crash typechecking ill-formed program with generic type’s method missing } before enum
| Originator: | rix.rob | ||
| Number: | rdar://22206006 | Date Originated: | 09-Aug-2015 05:37 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A176x) |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
Found by careful observation of SourceKitService’s flailing.
Steps to Reproduce:
1. This (ill-formed) program:
struct S<A> {
func f() {
if true {
}
}
enum E {
func f() -> E {
return .End
}
case End
}
Expected Results:
should not crash the compiler
Actual Results:
but totally does:
Assertion failed: ((type.isNull() || !type->is<PolymorphicFunctionType>()) && "decl has polymorphic function type but no interface type"), function getInterfaceType, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.52.2/src/swift/lib/AST/Decl.cpp, line 1735.
0 swift 0x000000011194ebbb llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x000000011194f2fb SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff992d8eaa _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff502f3000 _sigtramp + 3070337392
4 libsystem_c.dylib 0x00007fff9b3a33fb abort + 129
5 libsystem_c.dylib 0x00007fff9b36aa44 basename + 0
6 swift 0x00000001100bf40b swift::ValueDecl::getInterfaceType() const + 523
7 swift 0x000000010ff18b05 swift::constraints::ConstraintSystem::getTypeOfMemberReference(swift::Type, swift::ValueDecl*, bool, bool, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*, swift::constraints::DependentTypeOpener*) + 485
8 swift 0x000000010ff1a14c swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) + 588
9 swift 0x000000010ff711b1 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 993
10 swift 0x000000010ff16ebc swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 28
11 swift 0x000000010ff19e9b swift::constraints::ConstraintSystem::addOverloadSet(swift::Type, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::constraints::ConstraintLocator*, swift::constraints::OverloadChoice*) + 331
12 swift 0x000000010ff6f2a9 swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 8345
13 swift 0x000000010ff70e1b swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 75
14 swift 0x000000010ff76521 swift::constraints::ConstraintSystem::simplify() + 113
15 swift 0x000000010ff796a2 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 50
16 swift 0x000000010ff7caa8 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 5000
17 swift 0x000000010ff79a7e swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 1038
18 swift 0x000000010ff79460 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 80
19 swift 0x000000010ffaaafb swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 731
20 swift 0x000000010ffb0502 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::Type, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 450
21 swift 0x000000011001526a swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 4154
22 swift 0x0000000110014369 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 313
23 swift 0x0000000110013789 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
24 swift 0x000000011001284f swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 415
25 swift 0x0000000110012661 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 49
26 swift 0x000000011001338a swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 138
27 swift 0x000000010ff9867c typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 220
28 swift 0x000000010ff994a9 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1913
29 swift 0x000000010fd9fc28 swift::CompilerInstance::performSema() + 4152
30 swift 0x000000010f90f50c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 748
31 swift 0x000000010f90efc8 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2728
32 swift 0x000000010f90b02f main + 2015
33 libdyld.dylib 0x00007fff97a025ad start + 1
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file boom.swift -target x86_64-apple-darwin15.0.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -color-diagnostics -module-name boom -o /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-80bd38.o
1. While type-checking 'f' at boom.swift:8:2
2. While type-checking expression at [boom.swift:9:10 - line:9:11] RangeText=".E"
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Regression:
If S is non-generic, it does not crash.
If E does not attempt to resolve a static symbol via .Blah syntax, it does not crash.
Notes:
N/A
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!