forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
7 changed files
with
92 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def boundary[T](body: (T => RuntimeException) => T): T = | ||
case class Break(value: T) extends RuntimeException | ||
try body(Break.apply) | ||
catch case Break(t) => t // warn: pattern matching on local classes is unsound currently | ||
|
||
def test = | ||
boundary[Int]: EInt => | ||
val v: String = boundary[String]: EString => | ||
throw EInt(3) | ||
v.length // a runtime error: java.lang.ClassCastException | ||
|
||
def boundaryCorrectBehaviour[T](body: (T => RuntimeException) => T): T = | ||
object local: | ||
// A correct implementation, but is still treated as a local class right now | ||
case class Break(value: T) extends RuntimeException | ||
try body(local.Break.apply) | ||
catch case local.Break(t) => t // warn |