diff options
author | VladimirNik <vladimir.nikolaev9@gmail.com> | 2016-02-22 14:50:35 +0100 |
---|---|---|
committer | VladimirNik <vladimir.nikolaev9@gmail.com> | 2016-03-03 14:06:28 +0100 |
commit | 447256c89148e07dfddcfc065bd5f0946b0ae9aa (patch) | |
tree | fed57dba62faa52d87803c8acfb2db36cd5f8207 /tests/neg/compExceptions | |
parent | af8fc529dfc6e321f84c036f3ebeaeb62e8e38c4 (diff) | |
download | dotty-447256c89148e07dfddcfc065bd5f0946b0ae9aa.tar.gz dotty-447256c89148e07dfddcfc065bd5f0946b0ae9aa.tar.bz2 dotty-447256c89148e07dfddcfc065bd5f0946b0ae9aa.zip |
Neg tests: remove xerror parameter from tests (compute based on // error)
Diffstat (limited to 'tests/neg/compExceptions')
-rw-r--r-- | tests/neg/compExceptions/structural.scala | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/neg/compExceptions/structural.scala b/tests/neg/compExceptions/structural.scala new file mode 100644 index 000000000..1d2506290 --- /dev/null +++ b/tests/neg/compExceptions/structural.scala @@ -0,0 +1,70 @@ +package p1 { + +object test123 { + type A = { def a: Int } + def f(a: A): A = a +} + +object structural2 { + type A = { def a: Int } + + type B = { + def b: Int + } + + type AB = A & B + + def f(ab: AB): AB = ab + + f(new { + def a = 43 + def b = 42 + }) +} +} + +package p2 { +object RClose { + type ReflectCloseable = { def close(): Unit } + def withReflectCloseable[T <: ReflectCloseable, R](s: T)(action: T => R): R = + try { + action(s) + } finally { + s.close() + } +} +} + +package p3 { +object Test { + def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t) + + def main(args: Array[String]): Unit = { + idMap(Some(5)) + idMap(Responder.constant(5)) + } +} +} +package p4 { + +trait A { self: Any { def p: Any } => + def f(b: => Unit): Unit = {} + f { p } // error: cannot access member 'p' from structural type +} +} + +package p5 { +// t2810 +object Test { + val closeable1: { def close(): Unit } = new scala.io.Source { val iter: Iterator[Char] = "".iterator } + val closeable2: { def close(): Unit } = new java.io.Closeable { def close() = {} } +} +} + +package p6 { + + class Refinements { + val y: C { val x: T; type T } // was adeprecated warning: illegal forward reference in refinement; now illegal + } + +} |