@@ -603,7 +603,7 @@ class Typer extends Namer
603
603
def typedTpt = checkSimpleKinded(typedType(tree.tpt))
604
604
def handlePattern : Tree = {
605
605
val tpt1 = typedTpt
606
- if (! ctx.isAfterTyper && pt != defn.ImplicitScrutineeTypeRef )
606
+ if (! ctx.isAfterTyper && pt.widenUnapplyPath != defn.ImplicitScrutineeTypeRef )
607
607
constrainPatternType(tpt1.tpe, pt)(ctx.addMode(Mode .GADTflexible ))
608
608
// special case for an abstract type that comes with a class tag
609
609
tryWithClassTag(ascription(tpt1, isWildcard = true ), pt)
@@ -1458,7 +1458,7 @@ class Typer extends Namer
1458
1458
if (ctx.isDependent) TypeOf .TypeApply (pt1.stripUnapplyPath.select(defn.Any_asInstanceOf ), bindTp)
1459
1459
else bindTp
1460
1460
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 )
1462
1462
if (ctx.mode.is(Mode .InPatternAlternative ))
1463
1463
ctx.error(i " Illegal variable ${sym.name} in pattern alternative " , tree.sourcePos)
1464
1464
assignType(cpy.Bind (tree)(tree.name, body1), sym)
@@ -1926,8 +1926,9 @@ class Typer extends Namer
1926
1926
if (arity <= Definitions .MaxTupleArity )
1927
1927
typed(desugar.smallTuple(tree).withSpan(tree.span), pt)
1928
1928
else {
1929
+ val ptwiden = pt.widenUnapplyPath
1929
1930
val pts =
1930
- if (arity == pt .tupleArity) pt .tupleElementTypes
1931
+ if (arity == ptwiden .tupleArity) ptwiden .tupleElementTypes
1931
1932
else List .fill(arity)(defn.AnyType )
1932
1933
val elems = (tree.trees, pts).zipped.map(typed(_, _))
1933
1934
if (ctx.mode.is(Mode .Type ))
0 commit comments