Skip to content

Commit 26a240b

Browse files
Fix inline-i2570.scala by removing special treatment of InfixOpBlock
1 parent e199fc8 commit 26a240b

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
@@ -621,13 +621,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
621621

622622
def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") {
623623
val (exprCtx, stats1) = typedBlockStats(tree.stats)
624-
val ept =
625-
if (tree.isInstanceOf[untpd.InfixOpBlock])
626-
// Right-binding infix operations are expanded to InfixBlocks, which may be followed by arguments.
627-
// Example: `(a /: bs)(op)` expands to `{ val x = a; bs./:(x) } (op)` where `{...}` is an InfixBlock.
628-
pt
629-
else pt.notApplied
630-
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
624+
val expr1 = typedExpr(tree.expr, pt.notApplied)(exprCtx)
631625
ensureNoLocalRefs(
632626
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))
633627
}

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)