File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ ProtocolConformance *RequirementFailure::getConformanceForConditionalReq(
134
134
135
135
ValueDecl *RequirementFailure::getDeclRef () const {
136
136
auto &cs = getConstraintSystem ();
137
+ auto &TC = getTypeChecker ();
137
138
138
139
auto *anchor = getRawAnchor ();
139
140
auto *locator = cs.getConstraintLocator (anchor);
@@ -156,7 +157,7 @@ ValueDecl *RequirementFailure::getDeclRef() const {
156
157
} else if (auto *UDE = dyn_cast<UnresolvedDotExpr>(anchor)) {
157
158
ConstraintLocatorBuilder member (locator);
158
159
159
- if (UDE-> getName (). isSimpleName ( DeclBaseName::createConstructor () )) {
160
+ if (TC. getSelfForInitDelegationInConstructor ( getDC (), UDE )) {
160
161
member = member.withPathElement (PathEltKind::ConstructorMember);
161
162
} else {
162
163
member = member.withPathElement (PathEltKind::Member);
Original file line number Diff line number Diff line change @@ -677,3 +677,13 @@ protocol C {
677
677
protocol D {
678
678
associatedtype Foo where Foo: String // expected-error {{type 'Self.Foo' constrained to non-protocol, non-class type 'String'}}
679
679
}
680
+
681
+ func member_ref_with_explicit_init( ) {
682
+ struct S < T: P > { // expected-note {{where 'T' = 'Int'}}
683
+ init ( _: T ) { }
684
+ init ( _: T , _ other: Int = 42 ) { }
685
+ }
686
+
687
+ _ = S . init ( 42 )
688
+ // expected-error@-1 {{generic struct 'S' requires that 'Int' conform to 'P'}}
689
+ }
You can’t perform that action at this time.
0 commit comments