Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ object RefChecks {
}
}
.exists
if !target.typeSymbol.denot.isAliasType && !target.typeSymbol.denot.isOpaqueAlias && hidden
if !target.typeSymbol.isOpaqueAlias && hidden
then report.warning(ExtensionNullifiedByMember(sym, target.typeSymbol), sym.srcPos)
end checkExtensionMethods

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions tests/warn/i16743.check
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-- [E194] Potential Issue Warning: tests/warn/i16743.scala:90:8 --------------------------------------------------------
90 | def length() = 42 // warn This extension method will be shadowed by .length() on String.
| ^
| Extension method length will never be selected from type String
| because String already has a member with the same name and compatible parameter types.
|
| longer explanation available when compiling with `-explain`
-- [E194] Potential Issue Warning: tests/warn/i16743.scala:30:6 --------------------------------------------------------
30 | def t = 27 // warn
| ^
Expand Down
2 changes: 1 addition & 1 deletion tests/warn/i16743.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Depends:
object Depending:
extension (using depends: Depends)(x: depends.Thing)
def y = 42
def length() = 42 // nowarn see Quote above
def length() = 42 // warn This extension method will be shadowed by .length() on String.
def f(using d: Depends) = d.thing.y
def g(using d: Depends) = d.thing.length()

Expand Down
1 change: 1 addition & 0 deletions tests/warn/i22233.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension (s: String) def length = 42 // warn
Loading