forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The check crashes the compiler when mapping over a capture variable in a type bound bound of the form CapSet^{C^} as well as path captures in function signatures. See the test capture-vars-subtyping2.scala for examples.
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
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
44 changes: 44 additions & 0 deletions
44
tests/neg-custom-args/captures/capture-vars-subtyping2.scala
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,44 @@ | ||
import language.experimental.captureChecking | ||
import caps.* | ||
|
||
trait BoundsTest: | ||
|
||
trait Bar { val f: () => Unit } | ||
def bar(x: Bar^, y: () ->{x.f} Unit): Unit = ??? | ||
|
||
val b: Bar^ = ??? | ||
|
||
def testTransMixed[A^, | ||
B >: CapSet <: A, | ||
C >: CapSet <: CapSet^{B^}, | ||
D >: CapSet <: C, | ||
E >: CapSet <: CapSet^{D^}, | ||
F >: CapSet <: CapSet^{A^,b}, | ||
X >: CapSet <: CapSet^{F^,D^}, | ||
Y >: CapSet^{F^} <: CapSet^{F^,A^,b}, | ||
Z >: CapSet^{b} <: CapSet^{b,Y^}] = | ||
val e: E = ??? | ||
val e2: CapSet^{E^} = e | ||
val ed: D = e | ||
val ed2: CapSet^{D^} = e | ||
val ec: C = e | ||
val ec2: CapSet^{C^} = e | ||
val eb: B = e | ||
val eb2: CapSet^{B^} = e | ||
val ea: A = e | ||
val ea2: CapSet^{A^} = e | ||
val ex: X = e // error | ||
val ex2: CapSet^{X^} = e // error | ||
val f: F = ??? | ||
val f2: CapSet^{F^} = f | ||
val y: Y = f | ||
val y2: CapSet^{Y^} = f | ||
val cb: CapSet^{b} = ??? | ||
val z: Z = cb | ||
val z2: CapSet^{Z^} = cb | ||
|
||
def callTransMixed = | ||
val x, y, z: Bar^ = ??? | ||
testTransMixed[CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{x,y,z}, CapSet^{b,x,y,z}] | ||
testTransMixed[CapSet^{x,y,z}, CapSet^{x,y}, CapSet^{x,y}, CapSet^{x}, CapSet^{}, CapSet^{b,x}, CapSet^{b}, CapSet^{b,x}, CapSet^{b}] | ||
testTransMixed[CapSet^{x,y,z}, CapSet^{x,y}, CapSet^{x,y}, CapSet^{x}, CapSet^{}, CapSet^{b,x}, CapSet^{b}, CapSet^{b,x}, CapSet^{b,x,y,z}] // error |