diff --git a/lib/Sema/TypeCheckProtocol.cpp b/lib/Sema/TypeCheckProtocol.cpp index 36e3528563a39..46bf605b73701 100644 --- a/lib/Sema/TypeCheckProtocol.cpp +++ b/lib/Sema/TypeCheckProtocol.cpp @@ -912,8 +912,7 @@ RequirementMatch swift::matchWitness( case ThrownErrorSubtyping::Subtype: // If there were no type parameters, we're done. - if (!reqThrownError->hasTypeVariable() && - !reqThrownError->hasTypeParameter()) + if (!reqThrownError->hasTypeParameter()) break; LLVM_FALLTHROUGH; diff --git a/test/decl/protocol/conforms/typed_throws.swift b/test/decl/protocol/conforms/typed_throws.swift index 352312819c4f5..85306c4ae5a5f 100644 --- a/test/decl/protocol/conforms/typed_throws.swift +++ b/test/decl/protocol/conforms/typed_throws.swift @@ -77,3 +77,17 @@ public protocol HasRethrowingMap: Sequence { } extension Array: HasRethrowingMap {} + +// rdar://149438520 -- incorrect handling of subtype relation between type parameter and Never +protocol DependentThrowing { + associatedtype E: Error + func f() throws(E) +} + +extension DependentThrowing { + func f() {} +} + +struct DefaultDependentThrowing: DependentThrowing { + typealias E = Error +} \ No newline at end of file