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-3917] Swift 3.1 compiler crash: Conformance already complete? #46502
Comments
@swift-ci create |
@DougGregor, look familiar? |
The `.swiftmodule` for JetPack's TableViewController.swift is missing nearly all of the witnesses for optional requirements. Odd. |
And... it's an unavailable requirement. We don't actually compute witnesses for those. |
Master: 25d58af |
3.1 PR: #7453 |
Comment by Marc Knaup (JIRA) This issue is only partially fixed. New repro using 3.1 snapshot 2017-02-21 (also crashes with same snapshot from master branch): git clone git@github.com:fluidsonic/JetPack.git -b swift-crash-2
xcodebuild build -workspace JetPack/Xcode/Project.xcworkspace -scheme All -configuration Debug -sdk iphonesimulator10.2 -toolchain org.swift.3120170221a Crash: Assertion failed: ((!isComplete() || isInvalid()) && "Conformance already complete?"), function setWitness, file /Users/buildnode/jenkins/workspace/oss-swift-3.1-package-osx/swift/lib/AST/ProtocolConformance.cpp, line 349.
0 swift 0x000000010e2137b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010e2129d6 llvm::sys::RunSignalHandlers() + 86
2 swift 0x000000010e213e09 SignalHandler(int) + 361
3 libsystem_platform.dylib 0x00007fffdf7d1bba _sigtramp + 26
4 libsystem_platform.dylib 0x00007fff54866ee0 _sigtramp + 1963545408
5 libsystem_c.dylib 0x00007fffdf658420 abort + 129
6 libsystem_c.dylib 0x00007fffdf61f893 basename_r + 0
7 swift 0x000000010c28c97f swift::NormalProtocolConformance::setWitness(swift::ValueDecl*, swift::Witness) const + 735
8 swift 0x000000010c14a1ba (anonymous namespace)::ConformanceChecker::resolveWitnessViaDefault(swift::ValueDecl*) + 458
9 swift 0x000000010c14595b swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 715
10 swift 0x000000010c28be62 swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 242
11 swift 0x000000010c137391 (anonymous namespace)::LookupResultBuilder::add(swift::ValueDecl*, swift::ValueDecl*, swift::Type) + 769
12 swift 0x000000010c136fe3 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 515
13 swift 0x000000010c0f369e swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 110
14 swift 0x000000010c0ff673 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 387
15 swift 0x000000010c20f076 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 1990
16 swift 0x000000010c20f138 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 2184
17 swift 0x000000010c20db94 swift::Expr::walk(swift::ASTWalker&) + 84
18 swift 0x000000010c0f4ecc swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 188
19 swift 0x000000010c0f7f1f swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 655
20 swift 0x000000010c16ab4d swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 493
21 swift 0x000000010c169e99 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
22 swift 0x000000010c1691da swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 394
23 swift 0x000000010c168ff4 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 132
24 swift 0x000000010c169bea swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 250
25 swift 0x000000010c17c739 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 201
26 swift 0x000000010c17d4e4 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1572
27 swift 0x000000010bdadba9 swift::CompilerInstance::performSema() + 3753
28 swift 0x000000010b3da13f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4255
29 swift 0x000000010b397c10 main + 3312
30 libdyld.dylib 0x00007fffdf5c4255 start + 1
31 libdyld.dylib 0x0000000000000045 start + 547601905
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-21-a.xctoolchain/usr/bin/swift -frontend -c -primary-file JetPack/Xcode/Sources/AppDelegate.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -I /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Products/Debug-iphonesimulator -F /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Products/Debug-iphonesimulator -F /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Products/Debug-iphonesimulator/JetPack-07550a9b -enable-testing -g -module-cache-path /Users/marc/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -serialize-debugging-options -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-generated-files.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-own-target-headers.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-project-headers.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/DerivedSources/x86_64 -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directoryJetPack/Xcode -emit-module-doc-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate~partial.swiftdoc -Onone -parse-as-library -module-name Project -emit-module-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.dia -emit-dependencies-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.d -emit-reference-dependencies-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.swiftdeps -o /Users/marc/Library/Developer/Xcode/DerivedData/Project-ezaxmlwgkqhliugiytckffkkvfdw/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.o
1. While type-checking 'test' at JetPack/Xcode/JetPack/Xcode/Sources/AppDelegate.swift:19:2
2. While type-checking expression at [JetPack/Xcode/Sources/AppDelegate.swift:20:3 - line:20:15] RangeText="_ = webView.b" Code: import JetPack
class TestScreen: WebViewController {
func test() {
_ = webView.bounds // compiler crash
}
} Note that JetPack's |
Comment by Marc Knaup (JIRA) I also get another compiler crash which might be related but I'm unable to create a repro for this: extension of TextInput is missing witness for UITextInputTraits.isSecureTextEntry
0 swift 0x000000010fbcb7b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010fbca9d6 llvm::sys::RunSignalHandlers() + 86
2 swift 0x000000010fbcbe09 SignalHandler(int) + 361
3 libsystem_platform.dylib 0x00007fffdf7d1bba _sigtramp + 26
4 libsystem_platform.dylib 0x0000000115c49291 _sigtramp + 910653169
5 libsystem_c.dylib 0x00007fffdf658420 abort + 129
6 swift 0x000000010dbc3b31 (anonymous namespace)::Verifier::verifyConformance(swift::Decl*, swift::ProtocolConformance*) + 1665
7 swift 0x000000010dbbd24e (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 3102
8 swift 0x000000010dbc6108 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 264
9 swift 0x000000010dbc5feb swift::Decl::walk(swift::ASTWalker&) + 27
10 swift 0x000000010dbb72fd swift::verify(swift::Decl*) + 157
11 swift 0x000000010d88553b swift::ModuleFile::verify() const + 91
12 swift 0x000000010d8cda78 swift::SerializedModuleLoader::verifyAllModules() + 40
13 swift 0x000000010db4d6c9 swift::ASTContext::verifyAllLoadedModules() const + 57
14 swift 0x000000010db355ca swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1802
15 swift 0x000000010d765ba9 swift::CompilerInstance::performSema() + 3753
16 swift 0x000000010cd9213f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4255
17 swift 0x000000010cd4fc10 main + 3312
18 libdyld.dylib 0x00007fffdf5c4255 start + 1
…
1. While verifying protocol conformance extension of TextInput in module 'XInterfaces' import JetPack
open class TextInput: View { // View is from JetPack
// plenty of code
}
extension TextInput: UITextInputTraits {
public var autocapitalizationType: UITextAutocapitalizationType {
get { return textField?.autocapitalizationType ?? textView?.autocapitalizationType ?? .none }
set {
textField?.autocapitalizationType = newValue
textView?.autocapitalizationType = newValue
}
}
// more properties like above but "isSecureTextEntry" is NOT implemented
} |
Reduced:
Note that these do need to be separate modules for this to reproduce. |
Workaround: rename any properties that might match an optional delegate method ( |
Considering this fixed, given the referenced pull request is merged and the associated test case is still in place. |
Environment
swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-09-a
Additional Detail from JIRA
md5: 22aab50348a70416448267d818424ed3
Issue Description:
The following code in
AppDelegate.swift
should issue a warning (method name almost satisfies protocol conformance).It does not issue a warning in Swift 3.0 and crashes the Swift 3.1 compiler:
Edit: Even using the correct method name crashes the compiler.
Steps to reproduce:
Output:
The text was updated successfully, but these errors were encountered: