Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error and adjust the terminology slightly about augmented redirecting constructors #4157

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
eernstg marked this conversation as resolved.
Show resolved Hide resolved

#### 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.
eernstg marked this conversation as resolved.
Show resolved Hide resolved

#### 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