diff options
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 6 | ||||
-rw-r--r-- | tests/repl/errmsgs.check | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 3835355e3..eda4a12dc 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -750,12 +750,14 @@ object desugar { case Tuple(args) => args mapConserve assignToNamedArg case _ => right :: Nil } - Apply(Select(left, op.name), args) + val selectPos = Position(left.pos.start, op.pos.end, op.pos.start) + Apply(Select(left, op.name).withPos(selectPos), args) } else { val x = ctx.freshName().toTermName + val selectPos = Position(op.pos.start, right.pos.end, op.pos.start) new InfixOpBlock( ValDef(x, TypeTree(), left).withMods(synthetic), - Apply(Select(right, op.name), Ident(x))) + Apply(Select(right, op.name).withPos(selectPos), Ident(x).withPos(left.pos))) } } diff --git a/tests/repl/errmsgs.check b/tests/repl/errmsgs.check index f0ccdf53f..0dc8e8ae5 100644 --- a/tests/repl/errmsgs.check +++ b/tests/repl/errmsgs.check @@ -78,4 +78,11 @@ scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr 4 |class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr | ^^^^^^^^ | value `barr` is not a member of Foo(foo) - did you mean `foo.bar`? +scala> val x: List[Int] = "foo" :: List(1) +-- [E007] Type Mismatch Error: <console> --------------------------------------- +4 |val x: List[Int] = "foo" :: List(1) + | ^^^^^ + | found: String($1$) + | required: Int + | scala> :quit |