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

follow-up to omitting types in augmentations #3948

Merged
merged 3 commits into from
Jul 8, 2024
Merged

follow-up to omitting types in augmentations #3948

merged 3 commits into from
Jul 8, 2024

Conversation

jakemac53
Copy link
Contributor

Follow up to some comments on #3940 after it was merged

Copy link
Member

@lrhn lrhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky stuff. I have ideas. I should try to collect them. 😄

working/augmentation-libraries/feature-specification.md Outdated Show resolved Hide resolved
working/augmentation-libraries/feature-specification.md Outdated Show resolved Hide resolved
working/augmentation-libraries/feature-specification.md Outdated Show resolved Hide resolved
present _(or the `class` was a `mixin class` declaration, which does not
allow `extends` clauses)_. We do not allow overwriting an existing
`extends`, but one can be filled in if none had been specified.
but one was already present _(or the `class` was a `mixin class`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"was already present".

This is an error that should probably be reported during augmentation application.

When applying an augmenting class declaration to a class definition (as defined by a base
declaration or a number of prior augmentations applied to a base declaration):

It's a compile-time error if the augmenting class declaration contains an extends clause and

  • the declaration is a mixin class declaration, or
  • the augmented class declaration already has a declared superclass.

If the augmented class definition has a declared superclass, the resulting class
definition has that superclass.
Otherwise, if the augmenting class definition has an extends clause with a type term S,
the the resulting class definition has S as declared superclass.
Otherwise the resulting class definition has no declared superclass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did reword this a bit, but I think it is all covered by other rules in a general fashion. Above, we say:

A class, enum, extension type, or mixin augmentation may specify `extends`,
`implements` and `with` clauses (when generally supported). The types
in these clauses are appended to the original declarations’ clauses of the same
kind, and if that clause did not exist previously, then it is added with
the new types. All regular rules apply after this appending process, so you
cannot have multiple `extends` on a class, or an `on` clause on an enum, etc.

working/augmentation-libraries/feature-specification.md Outdated Show resolved Hide resolved
@@ -458,7 +457,7 @@ The augmenting function does not have to pass the same arguments to
`augmented(…)` as were passed to it. It may invoke `augmented` once, more than
once, or not at all.

It is a compile-time error if, after type inheritance:
It is a compile-time error if, after type inference:

* The function signature of the augmenting function does not exactly match the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Don't know where we define it, but it's probably correct that a function signature differs from a function type in that it can contain covariant. It's a little iffy whether we can talk about non-interface-members as having a function signature, though.)

@jakemac53 jakemac53 merged commit 6e754ab into main Jul 8, 2024
3 checks passed
@jakemac53 jakemac53 deleted the follow-up branch July 8, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants