diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-17 17:24:09 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-08-17 15:39:14 -0700 |
commit | 0faeeba25efcae711eee75ba0bcd9682b892ee0e (patch) | |
tree | 004de09b02b49ee13da3889e3ef11c3d4b79c575 /tests/pos/spec-traits.scala | |
parent | 76025cd33a64e3ff9d4257f3462fcbd261a9694d (diff) | |
download | dotty-0faeeba25efcae711eee75ba0bcd9682b892ee0e.tar.gz dotty-0faeeba25efcae711eee75ba0bcd9682b892ee0e.tar.bz2 dotty-0faeeba25efcae711eee75ba0bcd9682b892ee0e.zip |
Add passing tests
Diffstat (limited to 'tests/pos/spec-traits.scala')
-rw-r--r-- | tests/pos/spec-traits.scala | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/pos/spec-traits.scala b/tests/pos/spec-traits.scala new file mode 100644 index 000000000..759fd2267 --- /dev/null +++ b/tests/pos/spec-traits.scala @@ -0,0 +1,64 @@ +trait A[@specialized(Int) T] { def foo: T } +class B extends A[Int] { val foo = 10 } +class C extends B + +// issue 3309 +class Lazy { + def test[U](block: => U): Unit = { block } + + test { lazy val x = 1 } +} + +// issue 3307 +class Bug3307 { + def f[Z](block: String => Z): Unit = { + block("abc") + } + + ({ () => + f { implicit x => println(x) } })() +} + +// issue 3301 + trait T[X] + +class Bug3301 { + def t[A]: T[A] = sys.error("stub") + + {() => { + type X = Int + + def foo[X] = t[X] + () + }} +} +// issue 3299 +object Failure { + def thunk(): Unit = { + for (i <- 1 to 2) { + val Array(a, b) = Array(1,2) + () + } + } +} + +// issue 3296 + +object AA +{ + def f(block: => Unit): Unit = {} + + object BB + { + f { + object CC + + () + } + } + + def foo[T](x: T) = { object A; false } +} + +// issue 3325 +object O { def f[@specialized T]: Unit = { for(k <- Nil: List[T]) { } } } |