Skip to content

Commit f627ae0

Browse files
Fix tests/run/implicitMatch.scala
By adding a few widenUnapplyPath...
1 parent 23c1e19 commit f627ae0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ class Typer extends Namer
603603
def typedTpt = checkSimpleKinded(typedType(tree.tpt))
604604
def handlePattern: Tree = {
605605
val tpt1 = typedTpt
606-
if (!ctx.isAfterTyper && pt != defn.ImplicitScrutineeTypeRef)
606+
if (!ctx.isAfterTyper && pt.widenUnapplyPath != defn.ImplicitScrutineeTypeRef)
607607
constrainPatternType(tpt1.tpe, pt)(ctx.addMode(Mode.GADTflexible))
608608
// special case for an abstract type that comes with a class tag
609609
tryWithClassTag(ascription(tpt1, isWildcard = true), pt)
@@ -1458,7 +1458,7 @@ class Typer extends Namer
14581458
if (ctx.isDependent) TypeOf.TypeApply(pt1.stripUnapplyPath.select(defn.Any_asInstanceOf), bindTp)
14591459
else bindTp
14601460
val sym = ctx.newPatternBoundSymbol(tree.name, symTp, tree.span)
1461-
if (pt == defn.ImplicitScrutineeTypeRef) sym.setFlag(Implicit)
1461+
if (pt.widenUnapplyPath == defn.ImplicitScrutineeTypeRef) sym.setFlag(Implicit)
14621462
if (ctx.mode.is(Mode.InPatternAlternative))
14631463
ctx.error(i"Illegal variable ${sym.name} in pattern alternative", tree.sourcePos)
14641464
assignType(cpy.Bind(tree)(tree.name, body1), sym)
@@ -1926,8 +1926,9 @@ class Typer extends Namer
19261926
if (arity <= Definitions.MaxTupleArity)
19271927
typed(desugar.smallTuple(tree).withSpan(tree.span), pt)
19281928
else {
1929+
val ptwiden = pt.widenUnapplyPath
19291930
val pts =
1930-
if (arity == pt.tupleArity) pt.tupleElementTypes
1931+
if (arity == ptwiden.tupleArity) ptwiden.tupleElementTypes
19311932
else List.fill(arity)(defn.AnyType)
19321933
val elems = (tree.trees, pts).zipped.map(typed(_, _))
19331934
if (ctx.mode.is(Mode.Type))

0 commit comments

Comments
 (0)