diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-06-15 17:50:04 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-06-15 17:50:04 +0200 |
commit | 506a5e334d57084322fa89119d72fa96beb824b6 (patch) | |
tree | 83401f75400ac373e5ae68d633bbf9de2b6ce8d9 /tests/run/t8280.scala | |
parent | c4c29e393afb7175422053924b7e1e5a30131c4c (diff) | |
download | dotty-506a5e334d57084322fa89119d72fa96beb824b6.tar.gz dotty-506a5e334d57084322fa89119d72fa96beb824b6.tar.bz2 dotty-506a5e334d57084322fa89119d72fa96beb824b6.zip |
Enable tests that succeed.
Diffstat (limited to 'tests/run/t8280.scala')
-rw-r--r-- | tests/run/t8280.scala | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala new file mode 100644 index 000000000..0734d63b6 --- /dev/null +++ b/tests/run/t8280.scala @@ -0,0 +1,82 @@ +import scala.language.implicitConversions + +object Test { + def main(args: Array[String]): Unit = { + Moop1.ob1 + Moop1.ob2 + Moop1.ob3 + Moop2.ob1 + Moop2.ob2 + Moop2.ob3 + Moop3.ob1 + Moop3.ob2 + Moop3.ob3 + } +} + +// int object vs. +object Moop1 { + object ob1 { + implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" } + implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" } + + println(5: String) + } + object ob2 { + implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" } + implicit def f2(x: Long): String = "Long" + + println(5: String) + } + object ob3 { + implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" } + implicit val f2: Long => String = _ => "Long" + + println(5: String) + } +} + +// int def vs. +object Moop2 { + object ob1 { + implicit def f1(x: Int): String = "Int" + implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" } + + println(5: String) + } + object ob2 { + implicit def f1(x: Int): String = "Int" + implicit def f2(x: Long): String = "Long" + + println(5: String) + } + object ob3 { + implicit def f1(x: Int): String = "Int" + implicit val f2: Long => String = _ => "Long" + + println(5: String) + } +} + +// int val vs. +object Moop3 { + object ob1 { + implicit val f1: Int => String = _ => "Int" + implicit object f2 extends (Long => String) { def apply(x: Long): String = "Long" } + + println(5: String) + } + object ob2 { + implicit val f1: Int => String = _ => "Int" + implicit def f2(x: Long): String = "Long" + + println(5: String) + } + object ob3 { + implicit val f1: Int => String = _ => "Int" + implicit val f2: Long => String = _ => "Long" + + println(5: String) + } +} + |