File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ ValueDecl *RequirementFailure::getDeclRef() const {
102
102
ConstraintLocatorBuilder member (locator);
103
103
locator =
104
104
cs.getConstraintLocator (member.withPathElement (PathEltKind::Member));
105
+ } else if (isa<SubscriptExpr>(anchor)) {
106
+ ConstraintLocatorBuilder subscript (locator);
107
+ locator = cs.getConstraintLocator (
108
+ subscript.withPathElement (PathEltKind::SubscriptMember));
105
109
}
106
110
107
111
auto overload = getOverloadChoiceIfAvailable (locator);
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ protocol P { }
4
+ struct S < V> where V: P { // expected-note {{where 'V' = 'Double'}}
5
+ var value : V
6
+ }
7
+
8
+ struct A {
9
+ subscript< T> ( _ v: S < T > ) -> A { // expected-note {{where 'T' = 'Double'}}
10
+ fatalError ( )
11
+ }
12
+ }
13
+
14
+ func foo( _ v: Double ) {
15
+ _ = A ( ) [ S ( value: v) ]
16
+ // expected-error@-1 {{subscript 'subscript' requires that 'Double' conform to 'P'}}
17
+ // expected-error@-2 {{referencing initializer 'init(value:)' on 'S' requires that 'Double' conform to 'P'}}
18
+ }
You can’t perform that action at this time.
0 commit comments