You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code here is unprincipled, and mixes archetypes from
multiple sources:
1) The callee's generic environment
2) The caller's generic environment
3) Any random archetypes appearing in the original types of
typealiases, which could come from any generic environment
Initially, an UncurriedCandidate's type starts out as #1,
and then we sometimes set it to type #2 if the candidate is
a method on a base class.
We get swiftlang#3 by virtue of walking the original types of
SubstitutedTypes created as part of dependent member type
substitution.
However, it turns out the real reason the SubstitutedType
walk existed was so that #2 archetypes that appear in the
UncurriedCandidate's type map to themselves. This doesn't
require looking at the original type of a SubstitutedType
at all; instead we just walk the UncurriedCandidate's type
normally, collecting archetypes.
If we do this, the code doesn't (erroneously) pick up random
archetypes from typealiases, and this changes the output in
the RangeDiagnostics test. While we can debate if the new
diagnostics are better or worse (I think it's either a wash,
or slightly better) the reason they changed is because more
in-depth diagnostic code is now executing, without breaking
things randomly as before. I suspect this is a good thing.
r0[0] // expected-error {{ambiguous use of 'subscript'}}
194
194
r1[0] // expected-error {{ambiguous use of 'subscript'}}
195
-
r2[0] // expected-error {{cannot convert value of type 'Int' to expected argument type 'Range<ClosedRangeIndex<_>>'}}
196
-
r3[0] // expected-error {{cannot convert value of type 'Int' to expected argument type 'Range<ClosedRangeIndex<_>>'}}
195
+
r2[0] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'Int'}}
196
+
// expected-note@-1 {{overloads for 'subscript'}}
197
+
r3[0] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'Int'}}
198
+
// expected-note@-1 {{overloads for 'subscript'}}
197
199
198
200
r0[UInt(0)] // expected-error {{ambiguous reference to member 'subscript'}}
199
201
r1[UInt(0)] // expected-error {{ambiguous use of 'subscript'}}
200
-
r2[UInt(0)] // expected-error {{cannot convert value of type 'UInt' to expected argument type 'Range<ClosedRangeIndex<_>>'}}
201
-
r3[UInt(0)] // expected-error {{cannot convert value of type 'UInt' to expected argument type 'Range<ClosedRangeIndex<_>>'}}
202
+
r2[UInt(0)] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'UInt'}}
203
+
// expected-note@-1 {{overloads for 'subscript' exist}}
204
+
r3[UInt(0)] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'UInt'}}
205
+
// expected-note@-1 {{overloads for 'subscript' exist}}
202
206
203
207
r0[0..<4] // expected-error {{ambiguous use of 'subscript'}}
204
208
r1[0..<4] // expected-error {{ambiguous use of 'subscript'}}
205
-
r2[0..<4] // expected-error {{cannot convert call result type 'CountableRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
206
-
r3[0..<4] // expected-error {{cannot convert call result type 'CountableRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
209
+
r2[0..<4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'CountableRange<Int>'}}
210
+
// expected-note@-1 {{overloads for 'subscript' exist}}
211
+
r3[0..<4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableRange<Int>'}}
212
+
// expected-note@-1 {{overloads for 'subscript' exist}}
207
213
(10..<100)[0] // expected-error {{ambiguous use of 'subscript'}}
208
-
(UInt(10)...100)[0..<4] // expected-error {{cannot convert call result type 'CountableRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
214
+
(UInt(10)...100)[0..<4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableRange<Int>'}}
215
+
// expected-note@-1 {{overloads for 'subscript'}}
209
216
210
217
r0[0...4] // expected-error {{ambiguous use of 'subscript'}}
211
218
r1[0...4] // expected-error {{ambiguous use of 'subscript'}}
212
-
r2[0...4] // expected-error {{cannot convert call result type 'CountableClosedRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
213
-
r3[0...4] // expected-error {{cannot convert call result type 'CountableClosedRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
214
-
(10...100)[0...4] // expected-error {{cannot convert call result type 'CountableClosedRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
215
-
(UInt(10)...100)[0...4] // expected-error {{cannot convert call result type 'CountableClosedRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
219
+
r2[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'CountableClosedRange<Int>'}}
220
+
// expected-note@-1 {{overloads for 'subscript'}}
221
+
r3[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableClosedRange<Int>'}}
222
+
// expected-note@-1 {{overloads for 'subscript'}}
223
+
(10...100)[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'CountableClosedRange<Int>'}}
224
+
// expected-note@-1 {{overloads for 'subscript'}}
225
+
(UInt(10)...100)[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableClosedRange<Int>'}}
226
+
// expected-note@-1 {{overloads for 'subscript'}}
216
227
217
228
r0[r0] // expected-error {{ambiguous use of 'subscript'}}
218
229
r0[r1] // expected-error {{ambiguous reference to member 'subscript'}}
r2[0..<4] // expected-error {{type 'ClosedRange<Int>' has no subscript members}}
256
275
r3[0..<4] // expected-error {{type 'ClosedRange<UInt>' has no subscript members}}
257
276
(10..<100)[0] // expected-error {{ambiguous use of 'subscript'}}
258
-
(UInt(10)...100)[0..<4] // expected-error {{cannot convert call result type}}
277
+
(UInt(10)...100)[0..<4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableRange<Int>'}}
278
+
// expected-note@-1 {{overloads for 'subscript'}}
259
279
260
280
r0[0...4] // expected-error {{type 'Range<Int>' has no subscript members}}
261
281
r1[0...4] // expected-error {{type 'Range<UInt>' has no subscript members}}
262
282
r2[0...4] // expected-error {{type 'ClosedRange<Int>' has no subscript members}}
263
283
r3[0...4] // expected-error {{type 'ClosedRange<UInt>' has no subscript members}}
264
-
(10...100)[0...4] // expected-error {{cannot convert call result type 'CountableClosedRange<_>' to expected type 'Range<ClosedRangeIndex<_>>'}}
265
-
(UInt(10)...100)[0...4] // expected-error {{cannot convert call result type}}
284
+
(10...100)[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<Int>' with an index of type 'CountableClosedRange<Int>'}}
285
+
// expected-note@-1 {{overloads for 'subscript'}}
286
+
(UInt(10)...100)[0...4] // expected-error {{cannot subscript a value of type 'CountableClosedRange<UInt>' with an index of type 'CountableClosedRange<Int>'}}
287
+
// expected-note@-1 {{overloads for 'subscript'}}
266
288
267
289
r0[r0] // expected-error {{type 'Range<Int>' has no subscript members}}
268
290
r0[r1] // expected-error {{type 'Range<Int>' has no subscript members}}
0 commit comments