Skip to content

Commit f001eef

Browse files
committed
Enable scala.Dynamic pending/untried tests.
1 parent 390a44c commit f001eef

23 files changed

+98
-120
lines changed

tests/neg/applydynamic_sip.check

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
tests/neg/applydynamic_sip.scala:8: error: value applyDynamic is not a member of Dynamic(Test.qual)
2+
possible cause: maybe a wrong Dynamic method signature?
3+
qual.sel(a, a2: _*) // error
4+
^
5+
tests/neg/applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter
6+
qual.sel(arg = a, a2: _*) // error
7+
^
8+
tests/neg/applydynamic_sip.scala:10: error: applyDynamicNamed does not support passing a vararg parameter
9+
qual.sel(arg, arg2 = "a2", a2: _*) // error
10+
^
11+
tests/neg/applydynamic_sip.scala:20: error: type mismatch:
12+
found : String("sel")
13+
required: Int
14+
bad1.sel // error
15+
^
16+
tests/neg/applydynamic_sip.scala:21: error: type mismatch:
17+
found : String("sel")
18+
required: Int
19+
bad1.sel(1) // error // error
20+
^
21+
tests/neg/applydynamic_sip.scala:21: error: method applyDynamic in class Bad1 does not take more parameters
22+
bad1.sel(1) // error // error
23+
^
24+
tests/neg/applydynamic_sip.scala:22: error: type mismatch:
25+
found : String("sel")
26+
required: Int
27+
bad1.sel(a = 1) // error // error
28+
^
29+
tests/neg/applydynamic_sip.scala:22: error: method applyDynamicNamed in class Bad1 does not take more parameters
30+
bad1.sel(a = 1) // error // error
31+
^
32+
tests/neg/applydynamic_sip.scala:23: error: type mismatch:
33+
found : String("sel")
34+
required: Int
35+
bad1.sel = 1 // error // error
36+
^
37+
tests/neg/applydynamic_sip.scala:23: error: method updateDynamic in class Bad1 does not take more parameters
38+
bad1.sel = 1 // error // error
39+
^
40+
tests/neg/applydynamic_sip.scala:32: error: method selectDynamic in class Bad2 does not take parameters
41+
bad2.sel // error
42+
^
43+
tests/neg/applydynamic_sip.scala:33: error: method applyDynamic in class Bad2 does not take parameters
44+
bad2.sel(1) // error
45+
^
46+
tests/neg/applydynamic_sip.scala:34: error: method applyDynamicNamed in class Bad2 does not take parameters
47+
bad2.sel(a = 1) // error
48+
^
49+
tests/neg/applydynamic_sip.scala:35: error: method updateDynamic in class Bad2 does not take parameters
50+
bad2.sel = 1 // error
51+
^
52+
14 errors found

tests/neg/applydynamic_sip.scala

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import scala.language.dynamics
2+
object Test extends App {
3+
val qual: Dynamic = ???
4+
val expr = "expr"
5+
val a = "a"
6+
val a2 = "a2"
7+
8+
qual.sel(a, a2: _*) // error
9+
qual.sel(arg = a, a2: _*) // error
10+
qual.sel(arg, arg2 = "a2", a2: _*) // error
11+
12+
class Bad1 extends Dynamic {
13+
def selectDynamic(n: Int) = n
14+
def applyDynamic(n: Int) = n
15+
def applyDynamicNamed(n: Int) = n
16+
def updateDynamic(n: Int) = n
17+
18+
}
19+
val bad1 = new Bad1
20+
bad1.sel // error
21+
bad1.sel(1) // error // error
22+
bad1.sel(a = 1) // error // error
23+
bad1.sel = 1 // error // error
24+
25+
class Bad2 extends Dynamic {
26+
def selectDynamic = 1
27+
def applyDynamic = 1
28+
def applyDynamicNamed = 1
29+
def updateDynamic = 1
30+
}
31+
val bad2 = new Bad2
32+
bad2.sel // error
33+
bad2.sel(1) // error
34+
bad2.sel(a = 1) // error
35+
bad2.sel = 1 // error
36+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
t6355b.scala:14: error: value applyDynamic is not a member of A
22
error after rewriting to x.<applyDynamic: error>("bippy")
33
possible cause: maybe a wrong Dynamic method signature?
4-
println(x.bippy(42))
4+
println(x.bippy(42)) // error
55
^
66
t6355b.scala:15: error: value applyDynamic is not a member of A
77
error after rewriting to x.<applyDynamic: error>("bippy")
88
possible cause: maybe a wrong Dynamic method signature?
9-
println(x.bippy("42"))
9+
println(x.bippy("42")) // error
1010
^
1111
two errors found

tests/untried/neg/t6355b.scala renamed to tests/neg/t6355b.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class B(method: String) {
1111
object Test {
1212
def main(args: Array[String]): Unit = {
1313
val x = new A
14-
println(x.bippy(42))
15-
println(x.bippy("42"))
14+
println(x.bippy(42)) // error
15+
println(x.bippy("42")) // error
1616
}
1717
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String
22
error after rewriting to CompilerError.this.test.applyDynamicNamed("crushTheCompiler")(scala.Tuple2("a", 1), scala.Tuple2("b", 2))
33
possible cause: maybe a wrong Dynamic method signature?
4-
test.crushTheCompiler(a = 1, b = 2)
4+
test.crushTheCompiler(a = 1, b = 2) // error
55
^
66
one error found

tests/untried/neg/t6920.scala renamed to tests/neg/t6920.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ class DynTest extends Dynamic {
66

77
class CompilerError {
88
val test = new DynTest
9-
test.crushTheCompiler(a = 1, b = 2)
9+
test.crushTheCompiler(a = 1, b = 2) // error
1010
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String
22
error after rewriting to X.this.d.applyDynamicNamed("meth")(scala.Tuple2("value1", 10), scala.Tuple2("value2", 100))
33
possible cause: maybe a wrong Dynamic method signature?
4-
d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed
4+
d.meth(value1 = 10, value2 = 100) // error: two arguments here, but only one is allowed
55
^
66
one error found

tests/untried/neg/t8006.scala renamed to tests/neg/t8006.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object X {
22
val d = new D
3-
d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed
3+
d.meth(value1 = 10, value2 = 100) // error: two arguments here, but only one is allowed
44
}
55
import language.dynamics
66
class D extends Dynamic {
File renamed without changes.
File renamed without changes.

tests/pending/run/t4536.scala renamed to tests/run/t4536.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
2-
3-
4-
5-
1+
import scala.language.dynamics
62

73
object dynamicObject extends Dynamic {
84
def applyDynamic(m: String)() = println("obj: " + m);
@@ -38,7 +34,7 @@ object dynamicMixin extends dynamicAbstractClass with dynamicTrait {
3834

3935
object Test {
4036

41-
def main(args: Array[String]) {
37+
def main(args: Array[String]) = {
4238
val cls = new dynamicClass
4339
dynamicMixin
4440
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/untried/neg/applydynamic_sip.check

Lines changed: 0 additions & 73 deletions
This file was deleted.

tests/untried/neg/applydynamic_sip.scala

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)