Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scala/scala3
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d398a86aa3790f5090866da4b29fee0e46a8c6b7
Choose a base ref
..
head repository: scala/scala3
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2dfce4f054b7ddf882b33c7ccf663d33b65a1e02
Choose a head ref
Showing with 48 additions and 7 deletions.
  1. +28 −0 tests/warn/i22232.check
  2. +20 −7 tests/warn/i22232.scala
28 changes: 28 additions & 0 deletions tests/warn/i22232.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- [E194] Potential Issue Warning: tests/warn/i22232.scala:3:23 --------------------------------------------------------
3 | extension (c: C) def equals(that: Any): Boolean = false // warn
| ^
| Extension method equals will never be selected from type C
| because C 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/i22232.scala:9:25 --------------------------------------------------------
9 | extension (d: D) def equals(that: Any): Boolean = false // warn
| ^
| Extension method equals will never be selected from type C
| because C 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/i22232.scala:13:38 -------------------------------------------------------
13 | extension (arr: MyString[Byte]) def length: Int = 0 // warn
| ^
| 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/i22232.scala:17:46 -------------------------------------------------------
17 | extension [T <: MyString[Byte]](arr: T) def length: Int = 0 // warn
| ^
| 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`
27 changes: 20 additions & 7 deletions tests/warn/i22232.scala
Original file line number Diff line number Diff line change
@@ -8,12 +8,25 @@ object X:
object D:
extension (d: D) def equals(that: Any): Boolean = false // warn

object Upperbound:
opaque type IArray[+T] <: String = String
extension (arr: IArray[Byte]) def length: Int = 0 // warn
extension [T <: Int](arr: T) def length: Int = 0 // nowarn
object Upperbound1:
opaque type MyString[+T] <: String = String
extension (arr: MyString[Byte]) def length: Int = 0 // warn

object NonUpperbound:
opaque type IArray[+T] = String
extension (arr: IArray[Byte]) def length: Int = 0 // nowarn
object Upperbound2:
opaque type MyString[+T] <: String = String
extension [T <: MyString[Byte]](arr: T) def length: Int = 0 // warn

object Upperbound3:
opaque type MyString[+T] <: String = String
extension [T](arr: T) def length: Int = 0 // nowarn

object NonUpperbound1:
opaque type MyString[+T] = String
extension (arr: MyString[Byte]) def length: Int = 0 // nowarn
object NonUpperbound2:
opaque type MyString[+T] = String
extension [T <: MyString[Byte]](arr: T) def length2: Int = 0 // nowarn

object NonUpperbound3:
opaque type MyString[+T] = String
extension [T](arr: T) def length: Int = 0 // nowarn