Skip to content

Commit

Permalink
Add regression test for #22320 (#22321)
Browse files Browse the repository at this point in the history
This issue was found when running scala 3.6.2 code (latest stable
version for now), but it seems that a fix was submitted in
#21527 (which will be available in
3.6.3)

Closes #22320
  • Loading branch information
hamzaremmal authored Jan 8, 2025
2 parents 15ea35b + 2ae14c2 commit ec0a310
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/neg/i22320.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- [E008] Not Found Error: tests/neg/i22320.scala:19:19 ----------------------------------------------------------------
19 | val z = system.z // error
| ^^^^^^^^
| value z is not a member of a.System.
| An extension method was tried, but could not be fully constructed:
|
| a.z(system)
|
| failed with:
|
| Found: (system : a.System)
| Required: a.SimulatedSystem
19 changes: 19 additions & 0 deletions tests/neg/i22320.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package a:
opaque type System = Any
opaque type SimulatedSystem <: System = System

extension (system: System)
def x: BigInt = ???
def y: BigInt = ???
end extension

extension (system: SimulatedSystem)
def z: BigInt = ???
end extension

package b:
import a.*
def issue(system: System) =
val x = system.x
val y = system.y
val z = system.z // error

0 comments on commit ec0a310

Please sign in to comment.