Skip to content

Commit 75013f1

Browse files
committed
Harden typedUnapply
1 parent f053bfb commit 75013f1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
967967
case Apply(Apply(unapply, `dummyArg` :: Nil), args2) => assert(args2.nonEmpty); args2
968968
case Apply(unapply, `dummyArg` :: Nil) => Nil
969969
case Inlined(u, _, _) => unapplyImplicits(u)
970+
case _ => assert(ctx.reporter.errorsReported); Nil
970971
}
971972

972973
var argTypes = unapplyArgs(unapplyApp.tpe, unapplyFn, args, tree.pos)

tests/neg/parser-stability-10.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object i0 {
2+
def unapply(i1: Int)(i6: List[Int]): Int = {
3+
def i7(i8: i0) = i1 match { // error
4+
case i0(_) => // error
5+
(i1, i8) match {
6+
case i0(i1, i1) => case _ => i2 // error // error
7+
}
8+
}
9+
} // error
10+
object i5 {
11+
import collection.mutable._
12+
try { ??? mutable { case i1(i5, i3, i4) => i5 }} // error
13+
} // error

0 commit comments

Comments
 (0)