diff options
author | Martin Odersky <odersky@gmail.com> | 2014-07-14 13:17:34 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-07-17 11:02:03 +0200 |
commit | ace968dabf8e02f725f7b77cde90f64988a7b326 (patch) | |
tree | 10b4bd92cf02a5a391296f32a51ce3d5ff0d3164 /tests | |
parent | 57d69f8f4d00bef8cbb51d498b5139ca649a8ca6 (diff) | |
download | dotty-ace968dabf8e02f725f7b77cde90f64988a7b326.tar.gz dotty-ace968dabf8e02f725f7b77cde90f64988a7b326.tar.bz2 dotty-ace968dabf8e02f725f7b77cde90f64988a7b326.zip |
Fix to rewire types
t6574 has a new test where we produce identical code in an if-then-else. This broke
the rewiring logic before, and is fixed now.
Also, more comments and test cases.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pending/pos/class-dependent-extension-method.scala | 3 | ||||
-rw-r--r-- | tests/pos/enum-interop.scala | 13 | ||||
-rw-r--r-- | tests/pos/tailcall/t6574.scala | 8 |
3 files changed, 22 insertions, 2 deletions
diff --git a/tests/pending/pos/class-dependent-extension-method.scala b/tests/pending/pos/class-dependent-extension-method.scala new file mode 100644 index 000000000..b557dfa8f --- /dev/null +++ b/tests/pending/pos/class-dependent-extension-method.scala @@ -0,0 +1,3 @@ +class C(val a: String) extends AnyVal { + def foo[U <: a.type]: Unit = foo[U] +} diff --git a/tests/pos/enum-interop.scala b/tests/pos/enum-interop.scala new file mode 100644 index 000000000..0c9aca79b --- /dev/null +++ b/tests/pos/enum-interop.scala @@ -0,0 +1,13 @@ + + +object Test { + + val cls: java.lang.Class[_] = ??? + + def myAsInstanceOf[T <: Class[T]](cls: java.lang.Class[_]): Class[T] = cls.asInstanceOf[Class[T]] + Enum.valueOf(myAsInstanceOf(cls), "") + + + + +} diff --git a/tests/pos/tailcall/t6574.scala b/tests/pos/tailcall/t6574.scala index cd0fdbb8d..d8377ddbc 100644 --- a/tests/pos/tailcall/t6574.scala +++ b/tests/pos/tailcall/t6574.scala @@ -4,8 +4,12 @@ class Bad[X, Y](val v: Int) extends AnyVal { this.foo[Z](a)(b) } - @annotation.tailrec final def differentReceiver : Unit = { - {(); new Bad[X, Y](0)}.differentReceiver + @annotation.tailrec final def differentReceiver : Unit = + {(); new Bad[X, Y](0)}.differentReceiver + + @annotation.tailrec final def differentReceiver2 : Unit = { + if (true) {(); new Bad[X, Y](0)}.differentReceiver2 + else {(); new Bad[X, Y](0)}.differentReceiver2 } @annotation.tailrec final def dependent[Z](a: Int)(b: String): b.type = { |