From 71cd02b2c104b5c1df23fb3ce991a3c1eca38ff5 Mon Sep 17 00:00:00 2001 From: odersky Date: Wed, 6 Apr 2022 19:00:25 +0200 Subject: [PATCH] More regression tests Closes #9225 Closes #10437 --- tests/pos/i10437.scala | 27 +++++++++++++++++++++++++++ tests/run/i9225.scala | 13 +++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/pos/i10437.scala create mode 100644 tests/run/i9225.scala diff --git a/tests/pos/i10437.scala b/tests/pos/i10437.scala new file mode 100644 index 000000000000..3bf972c748cb --- /dev/null +++ b/tests/pos/i10437.scala @@ -0,0 +1,27 @@ +import scala.language.implicitConversions + +final class MyClass(name: String) { + + final class Fun0(val f: Function0[Any]) + + object Fun0 { + + implicit def function0AsFun0(f: Function0[Any]): Fun0 = new Fun0(f) + + } + + def apply(f: => Unit): Unit = { + apply(() => f) + } + + def apply(fun: Fun0): Unit = { + // Do something + println(s"Got a Fun0 $fun") + } + + def apply[T1](f: (T1) => Any)(implicit m1: Manifest[T1]): Unit = { + // Do something + println(s"Got a Function1: ${f}") + } + +} \ No newline at end of file diff --git a/tests/run/i9225.scala b/tests/run/i9225.scala new file mode 100644 index 000000000000..eb59366617f1 --- /dev/null +++ b/tests/run/i9225.scala @@ -0,0 +1,13 @@ +trait A { + val s = "same val in A" + def f: String = s +} + +class B extends A { + class C { + def call_f_in_A: String = B.super[A].f + } +} +val b = new B +val c = new b.C +@main def Test = c.call_f_in_A // AbstractMethodError \ No newline at end of file