Skip to content

Commit 4d24439

Browse files
Tweak tests
1 parent b23da82 commit 4d24439

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

tests/neg/i23435-min.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11

22
type Or[+A, +B] = A | B
33

4-
val x: Or[Int, String] & Or[String, Int] = 3
5-
val y: Or[Int & String, Int & String] = x // error
6-
val z: Int & String = y
4+
object Test1:
5+
val x: Or[Int, String] & Or[String, Int] = 3
6+
val y: Or[Int & String, String & Int] = x // error
7+
val z: String = y
8+
9+
// shows the distributeAnd logic should not be applied even when
10+
// the targs are pairwise TypeComparer#singletonInterval
11+
object Test2:
12+
val x: Or["3", Singleton] & Or[Singleton, "3"] = 3
13+
val y: Or["3", "3"] = x // error
14+
val z: String = y

tests/neg/specs2-23441-min.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// NOTE: does _not_ need to be a neg test,
2+
// NOTE: should _not_ necessarily be a neg test,
33
// added as minimization from community-build specs2 for #23441
44

55
def sameElementsAs[T](xs: Iterable[T], ys: Iterable[T], f: (T, T) => Boolean): Boolean =
@@ -15,4 +15,4 @@ def sameElementsAs[T](xs: Iterable[T], ys: Iterable[T], f: (T, T) => Boolean): B
1515

1616
sameElementsAs[T](resta, restb, f) // ok
1717
sameElementsAs(resta : List[T], restb, f) // ok
18-
sameElementsAs(resta, restb, f) // error, would be ok if we inferred as above
18+
sameElementsAs(resta, restb, f) // error, would be ok if we had inferred as above

tests/pos/reference/intersection-types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object t2 {
2626
}
2727

2828
val x: A & B = new C
29-
val ys: List[A & B] = x.children
29+
val ys: List[A] & List[B] = x.children
3030

3131
class C extends A with B {
3232
def children: List[A & B] = ???

0 commit comments

Comments
 (0)