Skip to content

Commit 355a8c7

Browse files
committed
Remove InfixOpBlock
And add a comment on possibly ode types returned from typedApply
1 parent 2ce92c3 commit 355a8c7

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

compiler/src/dotty/tools/dotc/ast/untpd.scala

-10
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
9696
override def isEmpty = true
9797
}
9898

99-
/** A block arising from a right-associative infix operation, where, e.g.
100-
*
101-
* a +: b
102-
*
103-
* is expanded to
104-
*
105-
* { val x = a; b.+:(x) }
106-
*/
107-
class InfixOpBlock(leftOperand: Tree, rightOp: Tree) extends Block(leftOperand :: Nil, rightOp)
108-
10999
/** A block generated by the XML parser, only treated specially by
110100
* `Positioned#checkPos` */
111101
class XMLBlock(stats: List[Tree], expr: Tree) extends Block(stats, expr)

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

+4
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,10 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
665665
def argCtx(app: untpd.Tree)(implicit ctx: Context): Context =
666666
if (untpd.isSelfConstrCall(app)) ctx.thisCallArgContext else ctx
667667

668+
/** Typecheck application. Result could be an `Apply` node,
669+
* or, if application is an operator assignment, also an `Assign` or
670+
* Block node.
671+
*/
668672
def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = {
669673

670674
def realApply(implicit ctx: Context): Tree = track("realApply") {

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -664,12 +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
667+
val ept = pt.notApplied
673668
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
674669
ensureNoLocalRefs(
675670
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))

0 commit comments

Comments
 (0)