Skip to content

Commit a71cb97

Browse files
authored
Merge pull request #2162 from abeln/infix-op
Fix #1959: infix type operators in the REPL
2 parents abd09ff + 4f937e1 commit a71cb97

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,11 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
526526
case Function(args, body) =>
527527
this(this(x, args), body)
528528
case InfixOp(left, op, right) =>
529-
this(this(x, left), right)
529+
this(this(this(x, left), op), right)
530530
case PostfixOp(od, op) =>
531-
this(x, od)
531+
this(this(x, od), op)
532532
case PrefixOp(op, od) =>
533-
this(x, od)
533+
this(this(x, op), od)
534534
case Parens(t) =>
535535
this(x, t)
536536
case Tuple(trees) =>

tests/repl/infixTypeOp.check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
scala> trait +[A, B]
2+
defined trait +
3+
scala> type IntAndString = Int + String
4+
defined type alias IntAndString
5+
scala> :quit

0 commit comments

Comments
 (0)