Skip to content

Commit b877103

Browse files
Fix inline-i2570.scala by removing special treatment of InfixOpBlock
1 parent 15ec223 commit b877103

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,7 @@ class Typer extends Namer
645645

646646
def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") {
647647
val (exprCtx, stats1) = typedBlockStats(tree.stats)
648-
val ept =
649-
if (tree.isInstanceOf[untpd.InfixOpBlock])
650-
// Right-binding infix operations are expanded to InfixBlocks, which may be followed by arguments.
651-
// Example: `(a /: bs)(op)` expands to `{ val x = a; bs./:(x) } (op)` where `{...}` is an InfixBlock.
652-
pt
653-
else pt.notApplied
654-
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
648+
val expr1 = typedExpr(tree.expr, pt.notApplied)(exprCtx)
655649
ensureNoLocalRefs(
656650
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))
657651
}

tests/pos/inline-i2570.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test {
2+
inline def sum2(ys: List[Int]): Int = (1 /: ys)(_ + _)
3+
val h1: ((List[Int]) => Int) = sum2
4+
}

0 commit comments

Comments
 (0)