From b0576e977c26a86a400755ab9810b90af73b3b8d Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 5 Feb 2017 13:28:11 +0100 Subject: Better positions for infix term operations. Preserving the position of infix operators is useful for IDEs' type-at-point. We also preserve the position of the untyped lhs of right-associative operators, this is useful both for IDEs and for error messages, before: 4 |val x: List[Int] = "foo" :: List(1) | ^ | found: String($1$) | required: Int | After: scala> val x: List[Int] = "foo" :: List(1) -- [E007] Type Mismatch Error: --------------------------------------- 4 |val x: List[Int] = "foo" :: List(1) | ^^^^^ | found: String($1$) | required: Int | Note: It would be even nicer if we displayed "String" instead of "String($1$)" since $1$ is synthetic, this commit does not address this. --- tests/repl/errmsgs.check | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/repl') 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: --------------------------------------- +4 |val x: List[Int] = "foo" :: List(1) + | ^^^^^ + | found: String($1$) + | required: Int + | scala> :quit -- cgit v1.2.3