Skip to content

Commit 641e040

Browse files
authored
Merge pull request #29683 from slavapestov/conditional-requirements-checking-screwup-5.2
Sema: Fix crash when property type references type alias with unsatisfied requirements [5.2]
2 parents 80a50c5 + 527a87c commit 641e040

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,10 +1461,6 @@ static Type resolveNestedIdentTypeComponent(
14611461
inferredAssocType);
14621462
}
14631463

1464-
// At this point, we need to have resolved the type of the member.
1465-
if (memberType->hasError())
1466-
return memberType;
1467-
14681464
// If there are generic arguments, apply them now.
14691465
return applyGenericArguments(memberType, resolution, comp, options);
14701466
};

test/Constraints/conditionally_defined_types.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,15 @@ let _ = Conforms<X>.Decl4<Z2>.Decl2.self // expected-error {{type 'Z2.T' (aka 'Y
222222
let _ = Conforms<X>.Decl4<Z2>.Decl3.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
223223
let _ = Conforms<X>.Decl4<Z2>.Decl4<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
224224
let _ = Conforms<X>.Decl4<Z2>.Decl5<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
225+
226+
// rdar://problem/45271663
227+
protocol PP { associatedtype V }
228+
struct SS<PI : PP> {}
229+
enum EE<A, B> {}
230+
extension EE : PP where A : PP, B : PP { typealias V = EE<A.V, B.V> }
231+
232+
protocol P2 { associatedtype U }
233+
func f<PI : PP & P2>(s: SS<PI>) -> SS<EE<PI.U, PI.U>> where PI.U : PP, PI.V : P2 {
234+
let t: EE<PI.V.U, PI.V.U>.V
235+
// expected-error@-1 {{type 'PI.V.U' does not conform to protocol 'PP'}}
236+
}

0 commit comments

Comments
 (0)