From 2ae14c270e7f8ec1d887fc851c79a236d1fd5661 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Wed, 8 Jan 2025 11:29:25 +0100 Subject: [PATCH] chore: add regression test for #22320 --- tests/neg/i22320.check | 12 ++++++++++++ tests/neg/i22320.scala | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/neg/i22320.check create mode 100644 tests/neg/i22320.scala diff --git a/tests/neg/i22320.check b/tests/neg/i22320.check new file mode 100644 index 000000000000..3bada9a0b73c --- /dev/null +++ b/tests/neg/i22320.check @@ -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 diff --git a/tests/neg/i22320.scala b/tests/neg/i22320.scala new file mode 100644 index 000000000000..4a9eccf08474 --- /dev/null +++ b/tests/neg/i22320.scala @@ -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 \ No newline at end of file