Skip to content

Commit

Permalink
Add an error and adjust the terminology slightly about augmented redi…
Browse files Browse the repository at this point in the history
…recting constructors (#4157)

Adjust the terminology slightly about augmented redirecting constructors
  • Loading branch information
eernstg authored Nov 14, 2024
1 parent a530cd6 commit 945b6e4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions working/augmentation-libraries/feature-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,9 @@ It is a compile-time error if:
replace a declared super constructor._ **(TODO: Why not? We allow
"replacing implementation", and this is *something* like that.)**

* The resulting constructor is not valid (has a redirecting initializer and
other initializers, multiple `super` initializers, etc).
* The resulting constructor is not valid *(it has a redirection as well as
some initializer list elements, or it has multiple `super` initializers,
etc)*.

* A non-redirecting constructor augments a constructor which is not
potentially non-redirecting.
Expand Down Expand Up @@ -923,20 +924,21 @@ present), and it may invoke the augmented body by calling

#### Redirecting generative constructors

A redirecting generative constructor marked `augment` adds its redirecting
initializer to the augmented constructors initializer list.
A redirecting generative constructor marked `augment` adds its redirection
to the augmented constructor.

This converts it into a redirecting generative constructor, removing the
potentially non-redirecting property of the constructor.

It is a compile-time error if:

* The augmented constructor has any initializers or a body.
* The augmented constructor has an initializer list or a body, or it has a
redirection.

#### Redirecting factory constructors

A redirecting factory constructor marked `augment` adds its factory redirection
to the augmented constructor.
*(e.g., `= C<int>.name`)* to the augmented constructor.

The result of applying the augmenting constructor is a redirecting factory
constructor with the same target constructor designation as the augmenting
Expand All @@ -945,7 +947,7 @@ constructor.

It is a compile-time error if:

* The augmented constructor has a body.
* The augmented factory constructor has a body, or it is redirecting.

#### Extension types

Expand Down Expand Up @@ -1201,8 +1203,6 @@ declaration ::= 'external'? factoryConstructorSignature
| constructorSignature (redirection | initializers)?
```

**TODO: Define the grammar for the various `augmented` expressions.**

It is a compile-time error if:

* A declaration marked `augment` is also marked `external`. **(TODO: Probably
Expand Down

0 comments on commit 945b6e4

Please sign in to comment.