mirror of
https://github.com/apple/swift.git
synced 2026-11-01 23:11:50 +01:00
A requirement defines the maximal effects that a witness can have. In some cases, we'd fail to properly reject such a witness with more effects, when that witness is valid for another requirement within that protocol. Thus, we'd hit an assertion failure in that case rather than permitting the valid program to compile. In a non-asserts compiler, we could end up failing to diagnose an invalid chosen witness and crash in IRGen. https://github.com/apple/swift/issues/73479 rdar://127669069
10 lines
1.0 KiB
Swift
10 lines
1.0 KiB
Swift
// {"kind":"typecheck","original":"19b50bfb","signature":"swift::RequirementMatch llvm::function_ref<swift::RequirementMatch (bool, llvm::ArrayRef<swift::OptionalAdjustment>)>::callback_fn<swift::matchWitness(llvm::DenseMap<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment, llvm::DenseMapInfo<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, void>, llvm::detail::DenseMapPair<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment>>&, swift::ProtocolDecl*, swift::RootProtocolConformance*, swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*)::$_2>(long, bool, llvm::ArrayRef<swift::OptionalAdjustment>)","signatureAssert":"Assertion failed: (getEffects(req).contains(getEffects(witness)) && \"witness has more effects than requirement?\"), function operator()"}
|
|
// RUN: not %target-swift-frontend -typecheck %s
|
|
protocol a {
|
|
associatedtype Element
|
|
::
|
|
func b(c: Element
|
|
}
|
|
extension Array: a {
|
|
b( Element) throws(Never
|