@@ -267,6 +267,19 @@ problems. We want it as a lint instead of a language restriction so that it
267
267
doesn’t interfere with macro-generated code, and so that users can ` // ignore: `
268
268
it if they know what they’re doing.
269
269
270
+ ### Type inheritance
271
+
272
+ When a type is omitted in an augmenting declaration, if the first declaration
273
+ that introduced the member has a type specified in the ommitted types position,
274
+ then that type is inherited.
275
+
276
+ This applies to return types, parameter types, variable types, and type
277
+ parameter bounds (but not type parameter names or regular parameter names, those
278
+ need to be re-declared).
279
+
280
+ It is a compile time error for a manually written type is not the same as a type
281
+ that would be inherited if that manually writted type had been omitted.
282
+
270
283
### Augmented Expression
271
284
272
285
The exact result of an ` augmented ` expression depends on what is being
@@ -445,7 +458,7 @@ The augmenting function does not have to pass the same arguments to
445
458
` augmented(…) ` as were passed to it. It may invoke ` augmented ` once, more than
446
459
once, or not at all.
447
460
448
- It is a compile-time error if:
461
+ It is a compile-time error if, after type inheritance :
449
462
450
463
* The function signature of the augmenting function does not exactly match the
451
464
function signature of the augmented function. This means the return types
@@ -719,7 +732,7 @@ to modify local variables, but the former introduces different variables than
719
732
the ones that existed when evaluating the initializer list. If the initializer
720
733
list captures variables in closures, that body may not work.)**
721
734
722
- It is a compile-time error if:
735
+ It is a compile-time error if, after type inheritance :
723
736
724
737
* The function signature of the augmenting constructor does not match the
725
738
signature of the augmented constructor. This means that the parameters must
0 commit comments