You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 23, 2020. It is now read-only.
expectCPSError("cannot cps-transform expression 8: type arguments [Int(8),String,Int] do not conform to method shiftUnit's type parameter bounds [A,B,C >: B]",
9
+
"""|def test(x: => Int @cpsParam[String,Int]) = 7
10
+
|
11
+
|def main(args: Array[String]) = {
12
+
| test(8)
13
+
|}""")
14
+
15
+
@Testdeffunction0=
16
+
expectCPSError("""|type mismatch;
17
+
| found : () => Int @scala.util.continuations.cpsParam[Int,Int]
18
+
| required: () => Int""".stripMargin,
19
+
"""|def main(args: Array[String]): Any = {
20
+
| val f = () => shift { k: (Int=>Int) => k(7) }
21
+
| val g: () => Int = f
22
+
|
23
+
| println(reset(g()))
24
+
|}""")
25
+
26
+
@Testdeffunction2=
27
+
expectCPSError(
28
+
"""|type mismatch;
29
+
| found : () => Int
30
+
| required: () => Int @scala.util.continuations.cpsParam[Int,Int]""".stripMargin,
31
+
"""|def main(args: Array[String]): Any = {
32
+
| val f = () => 7
33
+
| val g: () => Int @cps[Int] = f
34
+
|
35
+
| println(reset(g()))
36
+
|}""")
37
+
38
+
@Testdeffunction3=
39
+
expectCPSError(
40
+
"""|type mismatch;
41
+
| found : Int @scala.util.continuations.cpsParam[Int,Int]
42
+
| required: Int""".stripMargin,
43
+
"""|def main(args: Array[String]): Any = {
44
+
| val g: () => Int = () => shift { k: (Int=>Int) => k(7) }
45
+
|
46
+
| println(reset(g()))
47
+
|}""")
48
+
49
+
@Testdefinfer2=
50
+
expectCPSError("illegal answer type modification: scala.util.continuations.cpsParam[String,Int] andThen scala.util.continuations.cpsParam[String,Int]",
51
+
"""|def test(x: => Int @cpsParam[String,Int]) = 7
52
+
|
53
+
|def sym() = shift { k: (Int => String) => 9 }
54
+
|
55
+
|
56
+
|def main(args: Array[String]): Any = {
57
+
| test { sym(); sym() }
58
+
|}""")
59
+
60
+
@Testdef`lazy`=
61
+
expectCPSError("implementation restriction: cps annotations not allowed on lazy value definitions",
62
+
"""|def foo() = {
63
+
| lazy val x = shift((k:Unit=>Unit)=>k())
64
+
| println(x)
65
+
|}
66
+
|
67
+
|def main(args: Array[String]) = {
68
+
| reset {
69
+
| foo()
70
+
| }
71
+
|}""")
72
+
73
+
@Testdeft1929=
74
+
expectCPSError(
75
+
"""|type mismatch;
76
+
| found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth
77
+
| required: Int @scala.util.continuations.cpsParam[Int,String]""".stripMargin,
78
+
"""|def main(args : Array[String]) {
79
+
| reset {
80
+
| println("up")
81
+
| val x = shift((k:Int=>String) => k(8) + k(2))
82
+
| println("down " + x)
83
+
| val y = shift((k:Int=>String) => k(3))
84
+
| println("down2 " + y)
85
+
| y + x
86
+
| }
87
+
|}""")
88
+
89
+
@Testdeft2285=
90
+
expectCPSError(
91
+
"""|type mismatch;
92
+
| found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth
93
+
| required: Int @scala.util.continuations.cpsParam[Int,String]""".stripMargin,
0 commit comments