diff --git a/test/tasty/run/src-2/tastytest/TestIOApp.scala b/test/tasty/run/src-2/tastytest/TestIOApp.scala new file mode 100644 index 000000000000..e118f76f3308 --- /dev/null +++ b/test/tasty/run/src-2/tastytest/TestIOApp.scala @@ -0,0 +1,22 @@ +package tastytest + +/** test calling $init$ on IOApp parent */ +object TestIOApp extends Suite("TestIOApp") { + + def randOver5 = scala.util.Random.nextInt(5) + 5 + + object Static extends IOApp.Simple { + def run = assert(randOver5 >= 5) + } + + test("static IOApp")(Static.run) + + test("local IOApp") { + val Local = new IOApp.Simple { + def run = assert(randOver5 >= 5) + } + Local.run + } + + +} diff --git a/test/tasty/run/src-2/tastytest/TestTraitInitsBase.scala b/test/tasty/run/src-2/tastytest/TestTraitInitsBase.scala new file mode 100644 index 000000000000..799b49e62619 --- /dev/null +++ b/test/tasty/run/src-2/tastytest/TestTraitInitsBase.scala @@ -0,0 +1,15 @@ +package tastytest + +/** test calling $init$ on TraitInitsBase.SubTrait parent */ +object TestTraitInitsBase extends Suite("TestTraitInitsBase") { + + object Static extends TraitInitsBase.SubTrait {} + + test("static SubTrait")(assert(Static.foo === 23)) + + test("local SubTrait") { + val Local = new TraitInitsBase.SubTrait {} + assert(Local.foo === 23) + } + +} diff --git a/test/tasty/run/src-3/tastytest/IOApp.scala b/test/tasty/run/src-3/tastytest/IOApp.scala new file mode 100644 index 000000000000..6367f2b459f4 --- /dev/null +++ b/test/tasty/run/src-3/tastytest/IOApp.scala @@ -0,0 +1,23 @@ +package tastytest + +trait IOApp { + protected val foo = 23 + + def run(args: List[String]): Int + + final def main(args: Array[String]): Unit = { + sys.exit(run(args.toList)) + } + +} + +object IOApp { + trait Simple extends IOApp { + def run: Unit + + final def run(args: List[String]): Int = { + run + 0 + } + } +} diff --git a/test/tasty/run/src-3/tastytest/TraitInitsBase.scala b/test/tasty/run/src-3/tastytest/TraitInitsBase.scala new file mode 100644 index 000000000000..9346aba10d16 --- /dev/null +++ b/test/tasty/run/src-3/tastytest/TraitInitsBase.scala @@ -0,0 +1,8 @@ +package tastytest + +trait TraitInitsBase { + val foo = 23 +} +object TraitInitsBase { + trait SubTrait extends TraitInitsBase +}