Skip to content

Commit 98da9ce

Browse files
Update specs2 community project
And add minimization
1 parent 723a0ff commit 98da9ce

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tests/neg/specs2-23441-min.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
// NOTE: does _not_ need to be a neg test,
3+
// added as minimization from community-build specs2 for #23441
4+
5+
def sameElementsAs[T](xs: Iterable[T], ys: Iterable[T], f: (T, T) => Boolean): Boolean =
6+
val ita = xs.toList
7+
val itb = ys.toList
8+
9+
(ita, itb) match
10+
case (a: Iterable[?], b: Iterable[?]) =>
11+
sameElementsAs(a, b, f) // ok
12+
13+
val resta/* : Iterable[?] & List[T] inferred */= a.drop(1)
14+
val restb/* : Iterable[?] & List[T] inferred */= b.drop(1)
15+
16+
sameElementsAs[T](resta, restb, f) // ok
17+
sameElementsAs(resta : List[T], restb, f) // ok
18+
sameElementsAs(resta, restb, f) // error, would be ok if we inferred as above

0 commit comments

Comments
 (0)