Skip to content

Commit 2d6e803

Browse files
committed
better warning for higher-kinded types and alias types
1 parent e2db834 commit 2d6e803

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ast.tpd
1010
import core.Decorators._
1111
import core.TypeApplications._
1212
import core.Symbols._
13+
import core.StdNames._
1314
import core.NameOps._
1415
import core.Constants._
1516

@@ -401,7 +402,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
401402
case tp: ThisType => refine(tp.tref)
402403
case tp: NamedType =>
403404
val pre = refinePrefix(tp.prefix)
404-
if (pre.isEmpty) tp.name.show.stripSuffix("$")
405+
if (tp.name == tpnme.hkApply) pre
406+
else if (pre.isEmpty) tp.name.show.stripSuffix("$")
405407
else pre + "." + tp.name.show.stripSuffix("$")
406408
case _ => tp.show.stripSuffix("$")
407409
}
@@ -472,7 +474,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
472474

473475
def checkExhaustivity(_match: Match): Unit = {
474476
val Match(sel, cases) = _match
475-
val selTyp = sel.tpe.widen.elimAnonymousClass
477+
val selTyp = sel.tpe.widen.elimAnonymousClass.dealias
478+
476479

477480
val patternSpace = cases.map(x => project(x.pat)).reduce((a, b) => Or(List(a, b)))
478481
val uncovered = simplify(minus(Typ(selTyp, true), patternSpace))

0 commit comments

Comments
 (0)