diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-02-05 12:09:06 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-02-05 20:06:09 +0100 |
commit | 1f838edb02f6e5ced6641504a96cca3ec4c1fa7a (patch) | |
tree | 5091e2fcf280fbe2c2adfdaddc33f8e44ccdeab5 | |
parent | c9a0e36224b6eb2807bad0df2d5aa11bb05c8a32 (diff) | |
download | scala-1f838edb02f6e5ced6641504a96cca3ec4c1fa7a.tar.gz scala-1f838edb02f6e5ced6641504a96cca3ec4c1fa7a.tar.bz2 scala-1f838edb02f6e5ced6641504a96cca3ec4c1fa7a.zip |
[nomaster] verifies compat with 2.10.0
Makes sure that the compiler understands the 2.10.0 format of super
constructor calls after the recent revert from the typemacro-compatible
format.
-rw-r--r-- | test/files/run/t7064-old-style-supercalls.check | 1 | ||||
-rw-r--r-- | test/files/run/t7064-old-style-supercalls.scala | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/test/files/run/t7064-old-style-supercalls.check b/test/files/run/t7064-old-style-supercalls.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t7064-old-style-supercalls.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t7064-old-style-supercalls.scala b/test/files/run/t7064-old-style-supercalls.scala new file mode 100644 index 0000000000..cffa7b1888 --- /dev/null +++ b/test/files/run/t7064-old-style-supercalls.scala @@ -0,0 +1,48 @@ +import scala.reflect.runtime.universe._ +import Flag._ +import definitions._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox +import scala.tools.reflect.Eval + +object Test extends App { + val PARAMACCESSOR = (1L << 29).asInstanceOf[FlagSet] + + // these trees can be acquired by running the following incantation: + // echo 'class C(val x: Int); class D extends C(2)' > foo.scala + // ./scalac -Xprint:parser -Yshow-trees-stringified -Yshow-trees-compact foo.scala + + val c = ClassDef( + Modifiers(), newTypeName("C"), List(), + Template( + List(Select(Ident(ScalaPackage), newTypeName("AnyRef"))), + emptyValDef, + List( + ValDef(Modifiers(PARAMACCESSOR), newTermName("x"), Ident(newTypeName("Int")), EmptyTree), + DefDef( + Modifiers(), + nme.CONSTRUCTOR, + List(), + List(List(ValDef(Modifiers(PARAM | PARAMACCESSOR), newTermName("x"), Ident(newTypeName("Int")), EmptyTree))), + TypeTree(), + Block( + List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), + Literal(Constant(()))))))) + val d = ClassDef( + Modifiers(), newTypeName("D"), List(), + Template( + List(Ident(newTypeName("C"))), + emptyValDef, + List( + DefDef( + Modifiers(), + nme.CONSTRUCTOR, + List(), + List(List()), + TypeTree(), + Block( + List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List(Literal(Constant(2))))), + Literal(Constant(()))))))) + val result = Select(Apply(Select(New(Ident(newTypeName("D"))), nme.CONSTRUCTOR), List()), newTermName("x")) + println(cm.mkToolBox().eval(Block(List(c, d), result))) +}
\ No newline at end of file |