Skip to content

Commit 30097fe

Browse files
Fix inline-i2570.scala by removing special treatment of InfixOpBlock
1 parent 11b3e2c commit 30097fe

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
@@ -664,13 +664,7 @@ class Typer extends Namer
664664

665665
def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") {
666666
val (exprCtx, stats1) = typedBlockStats(tree.stats)
667-
val ept =
668-
if (tree.isInstanceOf[untpd.InfixOpBlock])
669-
// Right-binding infix operations are expanded to InfixBlocks, which may be followed by arguments.
670-
// Example: `(a /: bs)(op)` expands to `{ val x = a; bs./:(x) } (op)` where `{...}` is an InfixBlock.
671-
pt
672-
else pt.notApplied
673-
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
667+
val expr1 = typedExpr(tree.expr, pt.notApplied)(exprCtx)
674668
ensureNoLocalRefs(
675669
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))
676670
}

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)