Skip to content

Commit f683622

Browse files
committed
Adapt tests
1 parent 05e11fb commit f683622

File tree

7 files changed

+39
-39
lines changed

7 files changed

+39
-39
lines changed

tests/run/OrType.scala renamed to tests/neg/OrType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class B(val x: Int)
22
class C(val x: Double)
33

44
object Test{
5-
def bar(x: B | C): Int | Double = x.x
5+
def bar(x: B | C): Int | Double = x.x // error
66
def main(args: Array[String]): Unit = {
77
val b = new B(1)
88
val c = new C(1)

tests/pickling/unions.scala renamed to tests/neg/unions.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ object unions {
1616

1717
val x: A | B = if (true) new A else new B
1818
def y: B | A = if (true) new A else new B
19-
println(x.f)
20-
println(x.g(2))
21-
println(y.f)
22-
println(y.g(1.0))
23-
println(y.g(1.0f))
19+
println(x.f) // error
20+
println(x.g(2)) // error
21+
println(y.f) // error
22+
println(y.g(1.0)) // error
2423

2524
class C {
2625
private def foo = 0

tests/pos/i1045.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
import scala.collection._
2+
3+
object EmptyHashMap extends mutable.HashMap[Nothing, Nothing]
24
object T {
35
val newSymbolMap: mutable.HashMap[String, mutable.HashMap[Int, Double]] = mutable.HashMap.empty
46
val map = newSymbolMap.getOrElse("a", mutable.HashMap.empty)
57
map.put(1, 0.0)
68
newSymbolMap.put("a", map)
9+
10+
/** A map storing free variables of functions and classes */
11+
// type SymSet = Set[Symbol]
12+
// private val free = new collection.mutable.LinkedHashMap[Symbol, SymSet]
13+
// def freeVars(sym: Symbol): List[Symbol] = free.getOrElse(sym, Nil).toList
14+
15+
class Tree[X >: Null] { def tpe: X = null }
16+
class Ident[X >: Null] extends Tree[X]
17+
class Apply[X >: Null] extends Tree[X]
18+
19+
val x: Ident[Symbol] | Apply[Symbol] = ???
20+
val y = x.tpe
21+
val z: Symbol = y
22+
23+
724
}

tests/pos/union.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object Test {
2+
3+
class A
4+
class B extends A
5+
class C extends A
6+
class D extends A
7+
8+
val b = true
9+
val x = if (b) new B else new C
10+
val y: B | C = x
11+
}

tests/pos/unions.scala

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/run/OrderingTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ object Test extends dotty.runtime.LegacyApp {
2323
testAll(false, true)
2424
testAll(1, 2);
2525
testAll(1.0, 2.0);
26-
testAll(None, Some(1));
26+
// testAll(Some(1), Some(2)) // does not work in nsc or dotty
27+
// testAll(None, Some(1)); // does not work in dotty with or-types
2728
testAll[Iterable[Int]](List(1), List(1, 2));
2829
testAll[Iterable[Int]](List(1, 2), List(2));
2930
testAll((1, "bar"), (1, "foo"))

tests/run/flat-flat-flat.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ object Test {
22
def f1 = List(Iterator(Some(1), None, Some(2)), Iterator(Some(3), None))
33
def f2 = Iterator(List(Some(1), None, Some(2)), List(Some(3), None), Nil)
44
def f3 = List(Some(Iterator(1)), None, Some(Iterator(2, 3)))
5+
def f4 = List(Some(Iterator(1)), Some(Iterator(2, 3)))
6+
def f5 = Iterator(List(Some(1), Some(2)), List(Some(3)), Nil)
57

68
def main(args: Array[String]): Unit = {
79
assert(f1.flatten.flatten.toList == List(1, 2, 3))
10+
assert(f5.flatten.flatten.toList == List(1, 2, 3))
811
assert(f2.flatten.flatten.toList == List(1, 2, 3))
912
assert(f3.flatten.flatten.toList == List(1, 2, 3))
13+
assert(f4.flatten.flatten.toList == List(1, 2, 3))
1014
}
1115
}

0 commit comments

Comments
 (0)