@@ -96,7 +96,7 @@ class SortedList<X> {
96
96
}
97
97
98
98
extension<X extends Comparable<X>> on SortedList<X> {
99
- SortedList.ofComparable(): super ((X a, X b) => a.compareTo(b));
99
+ SortedList.ofComparable(): this ((X a, X b) => a.compareTo(b));
100
100
}
101
101
```
102
102
@@ -132,20 +132,23 @@ usual, e.g., if a redirecting factory constructor redirects to a
132
132
constructor that does not exist, or there is a redirection cycle.*
133
133
134
134
In an extension declaration of the form ` extension E on C {...} ` where ` C `
135
- is an identifier or an identifier with an import prefix that resolves to a
135
+ is an identifier or an identifier with an import prefix that denotes a
136
136
class, mixin, enum, or extension type declaration, we say that the
137
- _ on-class_ of the extension is ` C ` . If ` C ` resolves to a non-generic class
138
- then we say that the _ constructor return type_ of the extension is ` C ` .
137
+ _ on-class_ of the extension is ` C ` . If ` C ` denotes a non-generic class,
138
+ mixin, mixin class, or extension type then we say that the _ constructor return
139
+ type_ of the extension is ` C ` .
139
140
140
- * If ` C ` resolves to a generic class then the extension does not have a
141
- constructor return type.*
141
+ If ` C ` denotes a generic class then ` E ` is treated as
142
+ ` extension E on C<T1 .. Tk> {...} ` where ` T1 .. Tk ` are obtained by
143
+ instantiation to bound.
142
144
143
- In a extension of the form ` extension E on C<T1 .. Tk> {...} `
144
- where ` C ` is an identifier or prefixed identifier that resolves to a class,
145
+ In an extension of the form ` extension E on C<T1 .. Tk> {...} `
146
+ where ` C ` is an identifier or prefixed identifier that denotes a class,
145
147
mixin, enum, or extension type declaration, we say that the _ on-class_
146
148
of ` E ` is ` C ` , and the _ constructor return type_ of ` E ` is ` C<T1 .. Tk> ` .
147
149
148
- In all other cases, an extension declaration does not have an on-class.
150
+ In all other cases, an extension declaration does not have an on-class nor a
151
+ constructor return type.
149
152
150
153
* For example, an extension whose on-type is a type variable does not have
151
154
an on-class, and neither does an extension whose on-type is a function
@@ -165,8 +168,8 @@ Tools may report diagnostic messages like warnings or lints in certain
165
168
situations. This is not part of the specification, but here is one
166
169
recommended message:
167
170
168
- A compile-time message is emitted if a extension _ D_ declares a
169
- constructor or a static member with the same name as a constructor or a
171
+ A compile-time diagnostic is emitted if an extension _ D_ declares a
172
+ constructor or a static member with the same basename as a constructor or a
170
173
static member in the on-class of _ D_ .
171
174
172
175
* In other words, an extension should not have name clashes with its
@@ -194,10 +197,11 @@ on-class `C` and a static member named `m`.
194
197
195
198
If ` C ` contains such a declaration then the expression is an invocation of
196
199
that static member of ` C ` , with the same static analysis and dynamic
197
- behavior as before the introduction of this feature.
200
+ semantics as before the introduction of this feature.
198
201
199
- Otherwise, an error occurs if fewer than one or more than one declaration
200
- named ` m ` was found. * They would necessarily be declared in extensions.*
202
+ Otherwise, an error occurs if no declarations named ` m ` or more than one
203
+ declaration named ` m ` were found. * They would necessarily be declared in
204
+ extensions.*
201
205
202
206
Otherwise, the invocation is resolved to the given static member
203
207
declaration in an extension named ` Ej ` , and the invocation is treated
@@ -211,7 +215,7 @@ parameters `X1 extends B1 .. Xs extends Bs` and an actual type argument
211
215
list ` T1 .. Ts ` with a type known as the _ instantiated constructor return
212
216
type of_ _ D_ _ with type arguments_ ` T1 .. Ts ` .
213
217
214
- When an extension declaration _ D_ named ` E ` has an on-clause which is
218
+ When an extension declaration _ D_ named ` E ` has an on-clause which denotes
215
219
a non-generic class ` C ` , the instantiated constructor return type is ` C ` ,
216
220
for any list of actual type arguments.
217
221
@@ -221,7 +225,7 @@ passed in an explicitly resolved constructor invocation, e.g.,
221
225
` E<int>.C(42) ` . In all other invocations, the value of such type variables
222
226
is determined by instantiation to bound. In any case, the type parameters
223
227
are always ignored by static member declarations, they are only relevant to
224
- constructors.*
228
+ constructors and instance members .*
225
229
226
230
When an extension declaration _ D_ has no formal type parameters, and
227
231
it has an on-type ` C<S1 .. Sk> ` , the instantiated constructor return type
@@ -287,7 +291,7 @@ Otherwise, the invocation is partially resolved to a set of candidate
287
291
constructors found in extensions. Each of the candidates _ kj_ is
288
292
vetted as follows:
289
293
290
- Assume that _ kj_ is a constructor declared by a extension _ D_ named
294
+ Assume that _ kj_ is a constructor declared by an extension _ D_ named
291
295
` E ` with type parameters ` X1 extends B1 .. Xs extends Bs ` and on-type
292
296
` C<S1 .. Sm> ` . Find actual values ` U1 .. Us ` for ` X1 .. Xs ` satisfying the
293
297
bounds ` B1 .. Bs ` , such that ` ([U1/X1 .. Us/Xs]C<S1 .. Sm>) == C<T1 .. Tm> ` .
@@ -300,13 +304,13 @@ henceforth treated as `E<U1 .. Us>.C<T1 .. Tm>.name(args)` (respectively
300
304
` E<U1 .. Us>.C<T1 .. Tm>(args) ` ).
301
305
302
306
A constructor invocation of the form ` C.name(args) ` (respectively
303
- ` C(args) ` ) where ` C ` resolves to a non-generic class is resolved in the
307
+ ` C(args) ` ) where ` C ` denotes a non-generic class is resolved in the
304
308
same manner, with ` m == 0 ` . * In this case, type parameters declared by ` E `
305
309
will be bound to values selected by instantiation to bound.*
306
310
307
311
Consider a constructor invocation of the form ` C.name(args) ` (and similarly
308
- for ` C(args) ` ) where ` C ` resolves to a generic class. As usual, the
309
- invocation is treated as in the pre-feature language when it resolves to a
312
+ for ` C(args) ` ) where ` C ` denotes a generic class. As usual, the
313
+ invocation is treated as in the pre-feature language when it denotes a
310
314
constructor declared by the class ` C ` .
311
315
312
316
In the case where the context type schema for this invocation fully
@@ -315,7 +319,7 @@ receive said actual type arguments, `C<T1 .. Tm>.name(args)`, and treated
315
319
as described above.
316
320
317
321
In the case where the invocation resolves to exactly one constructor
318
- ` C.name ` (or ` C ` ) declared by a extension named ` E ` , the invocation
322
+ ` C.name ` (or ` C ` ) declared by an extension named ` E ` , the invocation
319
323
is treated as ` E.C.name(args) ` (respectively ` E.C(args) ` ).
320
324
321
325
Otherwise, when there are two or more candidates from extensions,
0 commit comments