Swift 2b2: Crash when constrained extension refers to types introduced by protocol conformance
| Originator: | rix.rob | ||
| Number: | rdar://21512599 | Date Originated: | 23-Jun-2015 06:21 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A121l) |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
Constraints on type extensions crash the compiler if they reference typealiases introduced by conformance to a protocol.
Steps to Reproduce:
1. This code:
protocol P {
typealias T
init(T)
}
struct S<Q>: P {
init(Q)
}
extension S where T : Equatable {}
Expected Results:
should not crash the compiler
Actual Results:
but totally does:
Assertion failed: (!pa->getUnresolvedReferences().empty() && "Missing unresolved references?"), function operator(), file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.42.3/src/swift/lib/AST/ArchetypeBuilder.cpp, line 1253.
0 swift 0x0000000102dafb9b llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x0000000102db02db SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff8a9b5f1a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff5ee4f9a0 _sigtramp + 3561593504
4 libsystem_c.dylib 0x00007fff8cb9fb53 abort + 129
5 libsystem_c.dylib 0x00007fff8cb67c39 basename + 0
6 swift 0x000000010149b286 swift::ArchetypeBuilder::finalize(swift::SourceLoc) + 2534
7 swift 0x000000010145de69 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::__1::function<bool (swift::ArchetypeBuilder&)>, bool&) + 201
8 swift 0x000000010144083a checkExtensionGenericParams(swift::TypeChecker&, swift::ExtensionDecl*, swift::Type, swift::GenericParamList*, swift::GenericSignature*&) + 426
9 swift 0x000000010143761f swift::TypeChecker::validateExtension(swift::ExtensionDecl*) + 239
10 swift 0x0000000101445dd3 (anonymous namespace)::DeclChecker::visitExtensionDecl(swift::ExtensionDecl*) + 35
…
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-darwin14.3.0 -enable-objc-interop -module-name boom -o /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-a3edd8.o
1. While type-checking declaration 0x7ffb2189a450 at boom.swift:9:1
<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:
N/A
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!