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-3917] Swift 3.1 compiler crash: Conformance already complete? #46502

Closed
swift-ci opened this issue Feb 10, 2017 · 12 comments
Closed

[SR-3917] Swift 3.1 compiler crash: Conformance already complete? #46502

swift-ci opened this issue Feb 10, 2017 · 12 comments
Assignees
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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-3917
Radar rdar://problem/30474860
Original Reporter marc (JIRA User)
Type Bug
Status Reopened
Resolution
Environment

swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-09-a

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 3.1Regression, CompilerCrash
Assignee @DougGregor
Priority Medium

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:

import JetPack

class Test: TableViewController {}

extension Test {

    func numberOfSectionsInTableView(_ tableView: UITableView) -> Int {
        return 0
    }
}

Edit: Even using the correct method name crashes the compiler.

Steps to reproduce:

git clone git@github.com:fluidsonic/JetPack.git -b swift-crash
xcodebuild build -workspace JetPack/Xcode/Project.xcworkspace -scheme All -configuration Debug -sdk iphonesimulator10.2 -toolchain org.swift.3120170209a

Output:

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 347.
0  swift                    0x0000000109e5f998 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x0000000109e5ebb6 llvm::sys::RunSignalHandlers() + 86
2  swift                    0x0000000109e5ffe9 SignalHandler(int) + 361
3  libsystem_platform.dylib 0x00007fffb85ddbba _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 1201808480
5  libsystem_c.dylib        0x00007fffb8464420 abort + 129
6  libsystem_c.dylib        0x00007fffb842b893 basename_r + 0
7  swift                    0x0000000107ed950f swift::NormalProtocolConformance::setWitness(swift::ValueDecl*, swift::Witness) const + 735
8  swift                    0x0000000107d973ca (anonymous namespace)::ConformanceChecker::resolveWitnessViaDefault(swift::ValueDecl*) + 458
9  swift                    0x0000000107d92adb swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 747
10 swift                    0x0000000107ed8a12 swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 226
11 swift                    0x0000000107d91411 swift::TypeChecker::findWitnessedObjCRequirements(swift::ValueDecl const*, bool) + 1265
12 swift                    0x0000000107d5d6a3 shouldMarkAsObjC(swift::TypeChecker&, swift::ValueDecl const*, bool) + 675
13 swift                    0x0000000107d69b95 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 4197
14 swift                    0x0000000107d59be0 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 576
15 swift                    0x0000000107d65deb (anonymous namespace)::DeclChecker::visitExtensionDecl(swift::ExtensionDecl*) + 555
16 swift                    0x0000000107d59a5c (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 188
17 swift                    0x0000000107d59994 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 100
18 swift                    0x0000000107dca1f4 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1300
19 swift                    0x00000001079fd719 swift::CompilerInstance::performSema() + 3753
20 swift                    0x0000000107029def swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4255
21 swift                    0x0000000106fe78c0 main + 3312
22 libdyld.dylib            0x000000010b642255 start + 1
23 libdyld.dylib            0x0000000000000045 start + 4103855601
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-09-a.xctoolchain/usr/bin/swift -frontend -c -primary-file <snip>/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-dttnnkfizamcfgbovlwpbaxjiikr/Build/Products/Debug-iphonesimulator -F /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Products/Debug-iphonesimulator -F /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/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-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-generated-files.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-own-target-headers.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/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-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/All-project-headers.hmap -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/DerivedSources/x86_64 -Xcc -I/Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory<snip>/JetPack/Xcode -emit-module-doc-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/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-dttnnkfizamcfgbovlwpbaxjiikr/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-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.dia -emit-dependencies-path /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/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-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.swiftdeps -o /Users/marc/Library/Developer/Xcode/DerivedData/Project-dttnnkfizamcfgbovlwpbaxjiikr/Build/Intermediates/Project.build/Debug-iphonesimulator/All.build/Objects-normal/x86_64/AppDelegate.o 
1.  While type-checking extension of Test at <snip>/JetPack/Xcode/Sources/AppDelegate.swift:19:1
2.  While type-checking 'numberOfSectionsInTableView' at <snip>/JetPack/Xcode/Sources/AppDelegate.swift:23:2
@belkadan
Copy link
Contributor

@swift-ci create

@belkadan
Copy link
Contributor

@DougGregor, look familiar?

@DougGregor
Copy link
Member

The `.swiftmodule` for JetPack's TableViewController.swift is missing nearly all of the witnesses for optional requirements. Odd.

@DougGregor
Copy link
Member

And... it's an unavailable requirement. We don't actually compute witnesses for those.

@DougGregor
Copy link
Member

Master: 25d58af

@DougGregor
Copy link
Member

3.1 PR: #7453

@swift-ci
Copy link
Collaborator Author

Comment by Marc Knaup (JIRA)

This issue is only partially fixed.
I still get this compiler crash but in a different situation.

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 WebViewController conforms to WKNavigationDelegate and WKUIDelegate through extension and has a property named webView.

@swift-ci
Copy link
Collaborator Author

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 + 11.  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
}

@belkadan
Copy link
Contributor

belkadan commented Mar 2, 2017

Reduced:

import Foundation

@objc public protocol Proto {
  @objc optional func badness()
}

public class Foo: Proto {
  public var badness: Int = 0 // unrelated
}
import Framework
func test(x: Foo) { _ = x.badness }

Note that these do need to be separate modules for this to reproduce.

@belkadan
Copy link
Contributor

belkadan commented Mar 2, 2017

Workaround: rename any properties that might match an optional delegate method (webView, textView, tableView, etc.)

@DougGregor
Copy link
Member

#7893

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis
Copy link
Collaborator

Considering this fixed, given the referenced pull request is merged and the associated test case is still in place.

@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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
Projects
None yet
Development

No branches or pull requests

4 participants