-
Notifications
You must be signed in to change notification settings - Fork 205
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
Conversation
There was a problem hiding this 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. 😄
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` |
There was a problem hiding this comment.
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 anextends
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 anextends
clause with a type termS
,
the the resulting class definition hasS
as declared superclass.
Otherwise the resulting class definition has no declared superclass.
There was a problem hiding this comment.
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.
@@ -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 |
There was a problem hiding this comment.
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.)
Follow up to some comments on #3940 after it was merged