diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/altherr3.scala | 164 | ||||
-rw-r--r-- | test/files/pos/valdefs.scala | 16 |
2 files changed, 180 insertions, 0 deletions
diff --git a/test/files/neg/altherr3.scala b/test/files/neg/altherr3.scala new file mode 100644 index 0000000000..a078c3a0bb --- /dev/null +++ b/test/files/neg/altherr3.scala @@ -0,0 +1,164 @@ +module bug { + +//########################################################################## + + trait Foo[a]; + + def foo0[a](x: a*): Foo[a] = foo0(); + + val foo1: Int = 0; + def foo1[a](x: a*): Foo[a] = foo1(); + + def bar0[a](x: a): Int = 0; + def bar1[a](x: Foo[a]): Int = 0; + def bar2[a](x: Foo[Foo[a]]): Int = 0; + def bar3[a](x: Foo[Foo[Foo[a]]]): Int = 0; + + +//########################################################################## + + bar0(foo0()); + bar0(foo0(foo0())); + bar0(foo0(foo0(foo0()))); + bar0(foo0(foo0(foo0(foo0())))); + + bar0[Int](foo0()); // error 1 + bar0[Int](foo0(foo0())); // error 2 + bar0[Int](foo0(foo0(foo0()))); // error 3 + bar0[Int](foo0(foo0(foo0(foo0())))); // error 4 + + bar0[Foo[Int]](foo0()); + bar0[Foo[Int]](foo0(foo0())); // error 5 + bar0[Foo[Int]](foo0(foo0(foo0()))); // error 6 + bar0[Foo[Int]](foo0(foo0(foo0(foo0())))); // error 7 + + bar0[Foo[Foo[Int]]](foo0()); + bar0[Foo[Foo[Int]]](foo0(foo0())); + bar0[Foo[Foo[Int]]](foo0(foo0(foo0()))); // error 8 + bar0[Foo[Foo[Int]]](foo0(foo0(foo0(foo0())))); // error 9 + + +//########################################################################## + + bar1(foo0()); + bar1(foo0(foo0())); + bar1(foo0(foo0(foo0()))); + bar1(foo0(foo0(foo0(foo0())))); + + bar1[Int](foo0()); + bar1[Int](foo0(foo0())); // error 10 + bar1[Int](foo0(foo0(foo0()))); // error 11 + bar1[Int](foo0(foo0(foo0(foo0())))); // error 12 + + bar1[Foo[Int]](foo0()); + bar1[Foo[Int]](foo0(foo0())); + bar1[Foo[Int]](foo0(foo0(foo0()))); // error 13 + bar1[Foo[Int]](foo0(foo0(foo0(foo0())))); // error 14 + + bar1[Foo[Foo[Int]]](foo0()); + bar1[Foo[Foo[Int]]](foo0(foo0())); + bar1[Foo[Foo[Int]]](foo0(foo0(foo0()))); + bar1[Foo[Foo[Int]]](foo0(foo0(foo0(foo0())))); // error 15 + + +//########################################################################## + + bar2(foo0()); + bar2(foo0(foo0())); + bar2(foo0(foo0(foo0()))); + bar2(foo0(foo0(foo0(foo0())))); + + bar2[Int](foo0()); + bar2[Int](foo0(foo0())); + bar2[Int](foo0(foo0(foo0()))); // error 16 + bar2[Int](foo0(foo0(foo0(foo0())))); // error 17 + + bar2[Foo[Int]](foo0()); + bar2[Foo[Int]](foo0(foo0())); + bar2[Foo[Int]](foo0(foo0(foo0()))); + bar2[Foo[Int]](foo0(foo0(foo0(foo0())))); // error 18 + + bar2[Foo[Foo[Int]]](foo0()); + bar2[Foo[Foo[Int]]](foo0(foo0())); + bar2[Foo[Foo[Int]]](foo0(foo0(foo0()))); + bar2[Foo[Foo[Int]]](foo0(foo0(foo0(foo0())))); + + +//########################################################################## + + bar3(foo0()); + bar3(foo0(foo0())); + bar3(foo0(foo0(foo0()))); + bar3(foo0(foo0(foo0(foo0())))); + + bar3[Int](foo0()); + bar3[Int](foo0(foo0())); + bar3[Int](foo0(foo0(foo0()))); + bar3[Int](foo0(foo0(foo0(foo0())))); // error 19 + + bar3[Foo[Int]](foo0()); + bar3[Foo[Int]](foo0(foo0())); + bar3[Foo[Int]](foo0(foo0(foo0()))); + bar3[Foo[Int]](foo0(foo0(foo0(foo0())))); + + bar3[Foo[Foo[Int]]](foo0()); + bar3[Foo[Foo[Int]]](foo0(foo0())); + bar3[Foo[Foo[Int]]](foo0(foo0(foo0()))); + bar3[Foo[Foo[Int]]](foo0(foo0(foo0(foo0())))); + + +//########################################################################## + +//########################################################################## + +//########################################################################## + + bar0(foo1()); + bar0(foo1(foo1())); + bar0(foo1(foo1(foo1()))); + bar0(foo1(foo1(foo1(foo1())))); + + bar0[Int](foo1()); // error 20 + bar0[Int](foo1(foo1())); // error 21 + bar0[Int](foo1(foo1(foo1()))); // error 22 + bar0[Int](foo1(foo1(foo1(foo1())))); // error 23 + + bar0[Foo[Int]](foo1()); + bar0[Foo[Int]](foo1(foo1())); // error 24 + bar0[Foo[Int]](foo1(foo1(foo1()))); // error 25 + bar0[Foo[Int]](foo0(foo1(foo1(foo1())))); // error 26 + + bar0[Foo[Foo[Int]]](foo1()); + bar0[Foo[Foo[Int]]](foo1(foo1())); + bar0[Foo[Foo[Int]]](foo1(foo1(foo1()))); // error 27 + bar0[Foo[Foo[Int]]](foo1(foo0(foo1(foo1())))); // error 28 + + +//########################################################################## + + bar1(foo1()); + bar1(foo1(foo1())); + bar1(foo1(foo1(foo1()))); + bar1(foo1(foo1(foo1(foo1())))); + + bar1[Int](foo1()); + bar1[Int](foo1(foo1())); // error 29 + bar1[Int](foo1(foo1(foo1()))); // error 30 + bar1[Int](foo1(foo1(foo1(foo1())))); // error 31 + + bar1[Foo[Int]](foo1()); + bar1[Foo[Int]](foo1(foo1())); + bar1[Foo[Int]](foo1(foo1(foo1()))); // error 32 + bar1[Foo[Int]](foo1(foo1(foo1(foo1())))); // error 33 + + bar1[Foo[Foo[Int]]](foo1()); + bar1[Foo[Foo[Int]]](foo1(foo1())); + bar1[Foo[Foo[Int]]](foo1(foo1(foo1()))); + bar1[Foo[Foo[Int]]](foo1(foo1(foo1(foo1())))); // error 34 + + +//########################################################################## +} + + + diff --git a/test/files/pos/valdefs.scala b/test/files/pos/valdefs.scala new file mode 100644 index 0000000000..b05edbf7b2 --- /dev/null +++ b/test/files/pos/valdefs.scala @@ -0,0 +1,16 @@ +module test { + + abstract class Base() { + val x: String; + val y = 1.0; + } + + case class Sub() extends Base() { + val x = "hello"; + override val y = 1; + } + + class Sub2() extends Base() { + override val Pair(x, y) = Pair("abc", 1); + } +}
\ No newline at end of file |