Prohibit the creation of extension methods with the same signatures from the underlying type #17821
Replies: 3 comments
-
the problem is not that it exists on the underlying type, it's that it exists on the upper-bound of the opaque type, which when left unspecified is |
Beta Was this translation helpful? Give feedback.
-
Oh, I thought you meant "underlying type of the opaque type", but if you meant "type on which the extension is defined" then nevermind my comment. |
Beta Was this translation helpful? Give feedback.
-
The feature ticket was #16743 I don't remember this exclusion mentioned on the PR:
I think the Here is the example using a
The original use case (FWIW) was that you write an extension for a 3rd party type but the 3rd party updates with the member. That was detected with JDK API and Dotty code. What's really wanted is a more expensive use site check: if my |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Compiler version
3.1.1-RC1
and earlierProposal
As far as I can see, if we create an extension method with the same signature, that already exists on the underlying type, then:
It'd be more clear if the creation of that methods will be prohibited (or at least warnings would be supplied).
Example 1
Example 2
Beta Was this translation helpful? Give feedback.
All reactions