diff options
author | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-03-12 22:44:33 +0100 |
---|---|---|
committer | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-03-12 22:44:33 +0100 |
commit | 9ef5f6817688f814a3450126aa7383b0928e80a0 (patch) | |
tree | 5727a2f7f7fd665cefdb312af2785c692f04377c /tests/untried/neg/sammy_restrictions.scala | |
parent | 194be919664447631ba55446eb4874979c908d27 (diff) | |
download | dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.gz dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.bz2 dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.zip |
add tests from scala/test/files/{pos,neg}
with explicit Unit return type
Diffstat (limited to 'tests/untried/neg/sammy_restrictions.scala')
-rw-r--r-- | tests/untried/neg/sammy_restrictions.scala | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/untried/neg/sammy_restrictions.scala b/tests/untried/neg/sammy_restrictions.scala new file mode 100644 index 000000000..5f1a04cd2 --- /dev/null +++ b/tests/untried/neg/sammy_restrictions.scala @@ -0,0 +1,45 @@ +class NoAbstract + +class TwoAbstract { def ap(a: Int): Int; def pa(a: Int): Int } + +class Base // check that the super class constructor isn't considered. +class NoEmptyConstructor(a: Int) extends Base { def this(a: String) = this(0); def ap(a: Int): Int } + +class OneEmptyConstructor() { def this(a: Int) = this(); def ap(a: Int): Int } + +class OneEmptySecondaryConstructor(a: Int) { def this() = this(0); def ap(a: Int): Int } + +class MultipleConstructorLists()() { def ap(a: Int): Int } + +class MultipleMethodLists()() { def ap(a: Int)(): Int } + +class ImplicitConstructorParam()(implicit a: String) { def ap(a: Int): Int } + +class ImplicitMethodParam() { def ap(a: Int)(implicit b: String): Int } + +class PolyClass[T] { def ap(a: T): T } + +class PolyMethod { def ap[T](a: T): T } + +class OneAbstract { def ap(a: Any): Any } +class DerivedOneAbstract extends OneAbstract + +object Test { + implicit val s: String = "" + type NonClassType = DerivedOneAbstract with OneAbstract + + (() => 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): MultipleMethodLists + ((x: Int) => 0): ImplicitConstructorParam + ((x: Int) => 0): ImplicitMethodParam + + ((x: Int) => 0): PolyClass[Int] // okay + ((x: Int) => 0): PolyMethod +} |