summaryrefslogtreecommitdiff
path: root/test/files/run/sammy_restrictions_LMF.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2016-03-29 18:18:09 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2016-03-29 23:19:26 -0700
commit3904c3216c741b387d81754e55aa079ce4218d06 (patch)
tree9d53968a9542a5b2791afac33d6f8fa2152b66dd /test/files/run/sammy_restrictions_LMF.scala
parent62d97d7f110894a0c2f36b1ed9dd7ad59c0115fa (diff)
downloadscala-3904c3216c741b387d81754e55aa079ce4218d06.tar.gz
scala-3904c3216c741b387d81754e55aa079ce4218d06.tar.bz2
scala-3904c3216c741b387d81754e55aa079ce4218d06.zip
LMF cannot instantiate SAM of trait with non-trait superclass
Also, drop AbstractFunction for parent of anonymous subclass of function type that must have its class spun up at compile time (rather than at linkage time by LambdaMetaFactory). This revealed an old problem with typedTemplate, in which parent types may be normalized at the level of trees, while this change does not get propagated to the class's info in time for the constructor to be located when we type check the primary constructor.
Diffstat (limited to 'test/files/run/sammy_restrictions_LMF.scala')
-rw-r--r--test/files/run/sammy_restrictions_LMF.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/run/sammy_restrictions_LMF.scala b/test/files/run/sammy_restrictions_LMF.scala
index 27a3d21dad..aa49e14113 100644
--- a/test/files/run/sammy_restrictions_LMF.scala
+++ b/test/files/run/sammy_restrictions_LMF.scala
@@ -8,6 +8,11 @@ trait TImpure { def apply(x: Int): String ; println(1) }
trait Println { println(1) }
trait TImpureSuper extends Println { def apply(x: Int): String }
+class C
+trait A extends C
+trait B extends A
+trait TClassParent extends B { def apply(x: Int): String }
+
object Test extends App {
final val AnonFunClass = "$anonfun$"
final val LMFClass = "$$Lambda$" // LambdaMetaFactory names classes like this
@@ -45,4 +50,8 @@ object Test extends App {
notLMF((x => "a"): TImpure)
notLMF((x => "a"): TImpureSuper)
+
+ val fClassParent: TClassParent = x => "a"
+ notLMF(fClassParent)
+ assert(fClassParent(1) == "a")
}