-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintarea:opaque-typesitype:bug
Milestone
Description
Compiler version
3.6.2
Minimized code
class C
object C:
extension (c: C) def equals(that: Any): Boolean = false // warn
object X:
class C
opaque type D <: C = C
object D:
extension (d: D) def equals(that: Any): Boolean = false // nowarn
Output
-- [E194] Potential Issue Warning: .../no-extension.scala:12:23 -
12 | extension (c: C) def equals(that: Any): Boolean = false
| ^
|Extension method equals will never be selected
|because C already has a member with the same name and compatible parameter types.
Expectation
Complain about defining extension methods which can't be invoked because they are universally available.
The loophole for opaque types is too wide.
Noticed at #17821.
nmcb and julian-a-avar-c
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintarea:opaque-typesitype:bug