diff --git a/lib/Sema/TypeCheckGeneric.cpp b/lib/Sema/TypeCheckGeneric.cpp index 9feb689a74511..038d02430f3eb 100644 --- a/lib/Sema/TypeCheckGeneric.cpp +++ b/lib/Sema/TypeCheckGeneric.cpp @@ -202,6 +202,11 @@ Type CompleteGenericTypeResolver::resolveDependentMemberType( if (auto proto = concrete->getDeclContext() ->getAsProtocolOrProtocolExtensionContext()) { + // Fast path: if there are no type parameters in the concrete type, just + // return it. + if (!concrete->getInterfaceType()->hasTypeParameter()) + return concrete->getInterfaceType(); + tc.validateDecl(proto); auto subMap = SubstitutionMap::getProtocolSubstitutions( proto, baseTy, ProtocolConformanceRef(proto)); diff --git a/test/decl/typealias/protocol.swift b/test/decl/typealias/protocol.swift index 856863a431acc..e625f2366577c 100644 --- a/test/decl/typealias/protocol.swift +++ b/test/decl/typealias/protocol.swift @@ -245,3 +245,10 @@ struct CandyEdible : Edible { // Edible.Snack is witnessed by 'typealias Snack' inside the // constrained extension of CandyWrapper above extension CandyBar : Edible {} + +protocol P9 { + typealias A = Int +} + +func testT9a(_: T, _: U) where T.A == U { } +func testT9b(_: T) where T.A == Float { } // expected-error{{'T.A' cannot be equal to both 'Float' and 'P9.A' (aka 'Int')}} diff --git a/validation-test/compiler_crashers/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift b/validation-test/compiler_crashers_fixed/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift similarity index 88% rename from validation-test/compiler_crashers/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift rename to validation-test/compiler_crashers_fixed/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift index 631ea5a7a3059..e507d78c2e4f9 100644 --- a/validation-test/compiler_crashers/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift +++ b/validation-test/compiler_crashers_fixed/28779-parent-parent-is-nominaltype-parent-is-boundgenerictype-parent-is-unboundgeneric.swift @@ -6,5 +6,5 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // REQUIRES: asserts -// RUN: not --crash %target-swift-frontend %s -emit-ir +// RUN: not %target-swift-frontend %s -emit-ir protocol P{func a:Self.a.a{}class a{class a