Skip to content

Commit af84a61

Browse files
committed
---
yaml --- r: 318455 b: refs/heads/master-rebranch c: 67b3abe h: refs/heads/master i: 318453: dcd0a00 318451: 1b43735 318447: eaf8d67
1 parent d43f164 commit af84a61

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,4 +1457,4 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14571457
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14581458
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14591459
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1460-
refs/heads/master-rebranch: f6b90145b01ae4657b5db2009b8df056428b92e6
1460+
refs/heads/master-rebranch: 67b3abe48199afd3029e7051250a3ecaafed70b4

branches/master-rebranch/lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ ProtocolConformance *RequirementFailure::getConformanceForConditionalReq(
134134

135135
ValueDecl *RequirementFailure::getDeclRef() const {
136136
auto &cs = getConstraintSystem();
137+
auto &TC = getTypeChecker();
137138

138139
auto *anchor = getRawAnchor();
139140
auto *locator = cs.getConstraintLocator(anchor);
@@ -156,7 +157,7 @@ ValueDecl *RequirementFailure::getDeclRef() const {
156157
} else if (auto *UDE = dyn_cast<UnresolvedDotExpr>(anchor)) {
157158
ConstraintLocatorBuilder member(locator);
158159

159-
if (UDE->getName().isSimpleName(DeclBaseName::createConstructor())) {
160+
if (TC.getSelfForInitDelegationInConstructor(getDC(), UDE)) {
160161
member = member.withPathElement(PathEltKind::ConstructorMember);
161162
} else {
162163
member = member.withPathElement(PathEltKind::Member);

branches/master-rebranch/test/Constraints/generics.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,13 @@ protocol C {
677677
protocol D {
678678
associatedtype Foo where Foo: String // expected-error {{type 'Self.Foo' constrained to non-protocol, non-class type 'String'}}
679679
}
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+
}

0 commit comments

Comments
 (0)