@@ -573,7 +573,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
573573 def typedBlock (tree : untpd.Block , pt : Type )(implicit ctx : Context ) = track(" typedBlock" ) {
574574 val exprCtx = index(tree.stats)
575575 val stats1 = typedStats(tree.stats, ctx.owner)
576- val expr1 = typedExpr(tree.expr, pt)(exprCtx)
576+ val ept = if (tree.isInstanceOf [untpd.InfixOpBlock ]) pt else pt.notApplied
577+ val expr1 = typedExpr(tree.expr, ept)(exprCtx)
577578 ensureNoLocalRefs(
578579 assignType(cpy.Block (tree)(stats1, expr1), stats1, expr1), pt, localSyms(stats1))
579580 }
@@ -620,8 +621,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
620621
621622 def typedIf (tree : untpd.If , pt : Type )(implicit ctx : Context ) = track(" typedIf" ) {
622623 val cond1 = typed(tree.cond, defn.BooleanType )
623- val thenp1 = typed(tree.thenp, pt)
624- val elsep1 = typed(tree.elsep orElse (untpd.unitLiteral withPos tree.pos), pt)
624+ val thenp1 = typed(tree.thenp, pt.notApplied )
625+ val elsep1 = typed(tree.elsep orElse (untpd.unitLiteral withPos tree.pos), pt.notApplied )
625626 val thenp2 :: elsep2 :: Nil = harmonize(thenp1 :: elsep1 :: Nil )
626627 assignType(cpy.If (tree)(cond1, thenp2, elsep2), thenp2, elsep2)
627628 }
@@ -794,7 +795,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
794795 val selType = widenForMatchSelector(
795796 fullyDefinedType(sel1.tpe, " pattern selector" , tree.pos))
796797
797- val cases1 = typedCases(tree.cases, selType, pt)
798+ val cases1 = typedCases(tree.cases, selType, pt.notApplied )
798799 val cases2 = harmonize(cases1).asInstanceOf [List [CaseDef ]]
799800 assignType(cpy.Match (tree)(sel1, cases2), cases2)
800801 }
@@ -921,8 +922,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
921922 }
922923
923924 def typedTry (tree : untpd.Try , pt : Type )(implicit ctx : Context ): Try = track(" typedTry" ) {
924- val expr1 = typed(tree.expr, pt)
925- val cases1 = typedCases(tree.cases, defn.ThrowableType , pt)
925+ val expr1 = typed(tree.expr, pt.notApplied )
926+ val cases1 = typedCases(tree.cases, defn.ThrowableType , pt.notApplied )
926927 val finalizer1 = typed(tree.finalizer, defn.UnitType )
927928 val expr2 :: cases2x = harmonize(expr1 :: cases1)
928929 val cases2 = cases2x.asInstanceOf [List [CaseDef ]]
@@ -1580,8 +1581,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
15801581 }
15811582
15821583 /** If this tree is a select node `qual.name`, try to insert an implicit conversion
1583- * `c` around `qual` so that `c(qual).name` conforms to `pt`. If that fails
1584- * return `tree` itself.
1584+ * `c` around `qual` so that `c(qual).name` conforms to `pt`.
15851585 */
15861586 def tryInsertImplicitOnQualifier (tree : Tree , pt : Type )(implicit ctx : Context ): Option [Tree ] = ctx.traceIndented(i " try insert impl on qualifier $tree $pt" ) {
15871587 tree match {
0 commit comments