diff options
Diffstat (limited to 'test/files/neg/sammy_restrictions.scala')
-rw-r--r-- | test/files/neg/sammy_restrictions.scala | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/test/files/neg/sammy_restrictions.scala b/test/files/neg/sammy_restrictions.scala index d003cfaf36..ff2c16b679 100644 --- a/test/files/neg/sammy_restrictions.scala +++ b/test/files/neg/sammy_restrictions.scala @@ -24,22 +24,29 @@ abstract class PolyMethod { def ap[T](a: T): T } abstract class OneAbstract { def ap(a: Int): Any } abstract class DerivedOneAbstract extends OneAbstract +abstract class SelfTp { self: NoAbstract => def ap(a: Int): Any } +abstract class SelfVar { self => def ap(a: Int): Any } + object Test { implicit val s: String = "" type NonClassType = DerivedOneAbstract with OneAbstract + // errors: (() => 0) : NoAbstract ((x: Int) => 0): TwoAbstract - ((x: Int) => 0): DerivedOneAbstract // okay - ((x: Int) => 0): NonClassType // "class type required". I think we should avoid SAM translation here. ((x: Int) => 0): NoEmptyConstructor - ((x: Int) => 0): OneEmptyConstructor // okay - ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. ((x: Int) => 0): MultipleConstructorLists + ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. ((x: Int) => 0): MultipleMethodLists ((x: Int) => 0): ImplicitConstructorParam ((x: Int) => 0): ImplicitMethodParam - - ((x: Int) => 0): PolyClass[Int] // okay ((x: Int) => 0): PolyMethod + ((x: Int) => 0): SelfTp + + // allowed: + ((x: Int) => 0): OneEmptyConstructor + ((x: Int) => 0): DerivedOneAbstract + ((x: Int) => 0): NonClassType // we also allow type aliases in instantiation expressions, if they resolve to a class type + ((x: Int) => 0): PolyClass[Int] + ((x: Int) => 0): SelfVar } |