-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bug
Description
Compiler version
3.8
Minimized code
class Foo(val someField: Int)
extension (foo: Foo)
def someField = foo.someField // warns even if private
def bar1 = 1 + someField
def bar2 = 2 + someField
def bar3 = 3 + someFieldOutput
5 | private def someField = foo.someField
| ^
|Extension method someField will never be selected from type Foo
|because Foo already has a member with the same name and compatible parameter types.Expectation
The someField extension is a trick to turn the references in barN to foo.someField, which as per the definition of the someField extension is the desired result.
Possibly, leveraging the trick should be permitted without warning if the extension is @unused or if the rhs is a forwarding expression.
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bug