Skip to content

Commit 4047dd9

Browse files
[tests] Adding SR-12383 regression test
1 parent 8a71164 commit 4047dd9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/Constraints/sr12383.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol Protocol {
4+
associatedtype Index: Comparable
5+
subscript(bounds: Range<Index>) -> Int { get }
6+
// expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int'); do you want to add a stub?}}
7+
subscript(position: Index) -> Int { get }
8+
}
9+
10+
struct Wrapper<Base: Protocol>: Protocol { // expected-error {{type 'Wrapper<Base>' does not conform to protocol 'Protocol'}}
11+
typealias Index = Base.Index
12+
subscript(bounds: Range<Index>) -> Int { // expected-note {{candidate has non-matching type '<Base> (Range<Wrapper<Base>.Index>) -> Int' (aka '<Base> (Range<Base.Index>) -> Int')}}
13+
get { 1 }
14+
}
15+
}

0 commit comments

Comments
 (0)