@@ -776,7 +776,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
776
776
777
777
def typedAppliedTypeTree (tree : untpd.AppliedTypeTree )(implicit ctx : Context ): AppliedTypeTree = track(" typedAppliedTypeTree" ) {
778
778
val tpt1 = typed(tree.tpt)
779
- val args1 = tree.args mapconserve (typed(_))
779
+ val argPts =
780
+ if (ctx.mode is Mode .Pattern ) tpt1.tpe.typeParams.map(_.info)
781
+ else tree.args.map(_ => WildcardType )
782
+ val args1 = tree.args.zipWithConserve(argPts)(typed(_, _)).asInstanceOf [List [Tree ]]
780
783
// check that arguments conform to bounds is done in phase FirstTransform
781
784
assignType(cpy.AppliedTypeTree (tree)(tpt1, args1), tpt1, args1)
782
785
}
@@ -798,7 +801,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
798
801
def typedBind (tree : untpd.Bind , pt : Type )(implicit ctx : Context ): Bind = track(" typedBind" ) {
799
802
val body1 = typed(tree.body, pt)
800
803
typr.println(i " typed bind $tree pt = $pt bodytpe = ${body1.tpe}" )
801
- val sym = ctx.newSymbol(ctx.owner, tree.name.asTermName , EmptyFlags , body1.tpe, coord = tree.pos)
804
+ val sym = ctx.newSymbol(ctx.owner, tree.name, EmptyFlags , body1.tpe, coord = tree.pos)
802
805
assignType(cpy.Bind (tree)(tree.name, body1), sym)
803
806
}
804
807
@@ -1339,7 +1342,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1339
1342
}
1340
1343
case _ =>
1341
1344
if (ctx.mode is Mode .Type )
1342
- if (tree.tpe <:< pt) tree
1345
+ if ((ctx.mode is Mode . Pattern ) || tree.tpe <:< pt) tree
1343
1346
else err.typeMismatch(tree, pt)
1344
1347
else adaptNoArgs(wtp)
1345
1348
}
0 commit comments