Skip to content

Commit 9dea057

Browse files
authored
Merge pull request #3743 from dotty-staging/fix-#2840
Fix #2840: Add regression test
2 parents c917cf8 + cd79513 commit 9dea057

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ object PatternMatcher {
969969
}
970970
def numConsts(cdefs: List[CaseDef]): Int = {
971971
val tpes = cdefs.map(_.pat.tpe)
972-
tpes.toSet.size: Int // without the type ascription, testPickling fails because of #2840.
972+
tpes.toSet.size
973973
}
974974
if (numConsts(resultCases) < numConsts(original.cases))
975975
ctx.warning(UnableToEmitSwitch(), original.pos)

tests/pickling/i2840.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object Test {
2+
class Type
3+
def f(x: Type): Type = ???
4+
def g(xs: List[Type]): Int = {
5+
val ys = xs.map(f)
6+
ys.toSet.size
7+
}
8+
}

0 commit comments

Comments
 (0)