aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/sams.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-30 15:09:06 +0200
committerMartin Odersky <odersky@gmail.com>2015-05-02 19:07:39 +0200
commitdbe0456b740e841ddd35fd0d9802aff95c7c4426 (patch)
treea48e95fdbd11bf7166e411595ff71559d6425616 /tests/pos/sams.scala
parent9be27ae2750b2554cf8d0719a4737f6420042995 (diff)
downloaddotty-dbe0456b740e841ddd35fd0d9802aff95c7c4426.tar.gz
dotty-dbe0456b740e841ddd35fd0d9802aff95c7c4426.tar.bz2
dotty-dbe0456b740e841ddd35fd0d9802aff95c7c4426.zip
More conditions under which SAMs are converted to anonymous classes
Also included are - Closures implementing classes that inherit from a class other than Object - Closures that implement traits which run initialization code.
Diffstat (limited to 'tests/pos/sams.scala')
-rw-r--r--tests/pos/sams.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pos/sams.scala b/tests/pos/sams.scala
index 671213fef..b7ef7dd2d 100644
--- a/tests/pos/sams.scala
+++ b/tests/pos/sams.scala
@@ -15,12 +15,24 @@ object test {
val u: U = (x: Int) => 2 // needs to be an anonymous class because of inherited field
+ trait V extends Exception { def foo(x: Int): Int }
+
+ val v: V = (x: Int) => 2 // needs to be an anonymous class because the trait extends a non-object class
+
trait Y extends X {
def baz = super.bar
}
val y: Y = (x: Int) => 2 // needs to be an anonymous class because of super accessor
+ trait Z {
+ def foo(x: Int): Int; println("hi there!")
+ }
+ trait ZZ extends Z
+
+ val z: Z = (x: Int) => 2 // needs to be an anonymous class because trait has initialization code
+ val zz: ZZ = (x: Int) => 2 // needs to be an anonymous class becaiuse trait has initialization code
+
abstract class C {
def foo(x: Int): Int