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-5546] Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!") #48118
Comments
slightly smaller repro public struct Foo<A, B> {}
public protocol P {
associatedtype PA
associatedtype PB = Never
typealias Context = Foo<PA, PB>
func f1(_ x: Context, _ y: PA)
func f2(_ x: Context, _ y: PB)
}
public struct S: P {
public typealias PA = Never
public func f1(_ x: Context, _ y: PA) {
}
public func f2(_ x: Context, _ y: PB) {
}
} |
@swift-ci create |
Even smaller repro:
It works if you switch the order of f1 and f2 inside struct S, but for the wrong reason. |
Hi @weissi, my suggested workaround would be to explicitly define the associated types as typealiases inside the concrete type, instead of relying on associated type inference. It is unlikely we'll be able to fix this for 4.0, at least not in a general way. |
Also tested in 3.1, it also crashes as I suspected, just a little bit later because the AST verifier is not compiled in. |
In getWitnessTypeForMatching(), the hasValidSignature() check should be an assertion, instead of silently bailing out:
|
@slavapestov with the Swift 4.1 dev snapshot from today both your and my reduced repro doesn't work anymore. The attached |
Fix for linked SR-8813 turns out to fix this as well. |
Attachment: Download
Additional Detail from JIRA
md5: 50c08792daff0f3df2d6e7f7ed336709
relates to:
Issue Description:
The following code
makes
Apple Swift version 4.0-dev (LLVM 2c7b572db2, Clang 54c8e38855, Swift d84e4b4de1)
crash withor this if it helps
from a very recent swiftc on master (the one from #11040
The text was updated successfully, but these errors were encountered: