Open tkrajacic opened 4 years ago
@swift-ci create
With asserts:
Assertion failed: (blockTy->getNumParameters() == funcTy->getNumParameters() && "block and function types don't match"), function buildBlockToFuncThunkBody, file /Volumes/Data/swift-public/swift/lib/SILGen/SILGenBridging.cpp, line 813.
Stack dump:
0. Program arguments: /Volumes/Data/swift-public/build/ninja/swift-macosx-x86_64/bin/swift -frontend -c -primary-file - -target x86_64-apple-darwin18.7.0 -enable-objc-interop -sdk /Volumes/Data/Applications/Xcode11.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk -color-diagnostics -module-name main -o /var/folders/_d/dmrgv26d3bs6lkrks9z825_w0000gn/T/--07983d.o
1. Swift version 5.1-dev (LLVM af1f73e9e9, Swift 886c0b0407)
2. While emitting SIL for 'applicationDidFinishLaunching(_:)' (at <stdin>:14:1)
3. While silgen emitFunction SIL function "@$s4main29applicationDidFinishLaunchingyy10Foundation12NotificationVF".
for 'applicationDidFinishLaunching(_:)' (at <stdin>:14:1)
which makes sense if we're modeling this as a closure value, because "closures don't throw through parameters".
Reproducer that doesn't depend on AppKit:
import Foundation
@objc public class Foo: NSObject {}
@objc public protocol Bar: AnyObject {
@objc optional func getFoo() throws -> Foo
}
class ImplementsBar: NSObject, Bar {
func getFoo() throws -> Foo { Foo() }
}
func crash() {
let bar: Bar = ImplementsBar()
let _ = try! bar.getFoo?()
}
Attachment: Download
Environment
Version 11.1 (11A1027) Catalina 10.15 (19A602)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, CompilerCrash | |Assignee | None | |Priority | Medium | md5: f43cf0c4761bc1c331095ebf1466908dIssue Description:
Given
This will segfault the compiler:
where using `importWindowController!()` works and also making the protocol requirement not optional.
Crash output
A sample project for your experimentation pleasure is attached