Skip to content

Commit e4a3735

Browse files
authored
clarify augmentations of abstract and external variables (#4000)
Closes #3998 - Clarifies some error cases for augmenting the getters/setters introduced by abstract and external variables. - Removes an error blocking augmentation of an abstract/external variable with a variable. This is allowed as long as it retains it abstract/external keyword. It can be used to add comments or annotations.
1 parent f35ecd9 commit e4a3735

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

working/augmentation-libraries/feature-specification.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Augmentations
22

33
4-
Version: 1.27 (see [Changelog](#Changelog) at end)
4+
Version: 1.28 (see [Changelog](#Changelog) at end)
55

66
Augmentations allow spreading your implementation across multiple locations,
77
both within a single file and across multiple files. They can add new top-level
@@ -679,8 +679,7 @@ It is a **compile-time error** if:
679679
* An augmenting declaration uses `augmented` when the augmented declaration
680680
has no concrete implementation. Note that all external declarations are
681681
assumed to have an implementation provided by another external source, and
682-
otherwise they will throw a runtime error when called. An `abstract`
683-
variable introduces no implementation.
682+
otherwise they will throw a runtime error when called.
684683

685684
* An augmenting variable’s initializing expression uses `augmented`, and
686685
the stack of augmented declarations do not include a variable with an
@@ -706,9 +705,6 @@ It is a **compile-time error** if:
706705

707706
* A getter or setter declaration is augmented by an augmenting variable.
708707

709-
* An abstract or external variable declaration is augmented by an
710-
augmenting variable.
711-
712708
* A late final variable with no initializer expression is augmented by an
713709
augmenting variable with an initializer expression.
714710
_A late final variable with no initializer has a setter, while one with an
@@ -719,6 +715,12 @@ It is a **compile-time error** if:
719715
const variable be augmented by another const variable, changing its value,
720716
or is that too weird?)**
721717

718+
* An `abstract` variable is augmented with a non-abstract variable, getter,
719+
or setter.
720+
721+
* An `external` declaration is augmented with an `abstract` declaration. For
722+
variables this also applies to the implicit getter and setter.
723+
722724
### Augmenting enum values
723725

724726
Enum values can _only_ be augmented by enum values, and the implicit getter
@@ -1352,6 +1354,15 @@ to the augmentation.
13521354

13531355
## Changelog
13541356

1357+
### 1.28
1358+
1359+
* Explicitly disallow augmenting abstract variables with non-abstract
1360+
variables, getters, or setters.
1361+
* Explicitly disallow augmenting external declarations with abstract
1362+
declarations.
1363+
* Remove error when augmenting an abstract or external variable with a
1364+
variable (allowed for adding comments/annotations).
1365+
13551366
### 1.27
13561367

13571368
* Specify that representation objects for extension types cannot be augmented.

0 commit comments

Comments
 (0)