Skip to content

Error reported at OffsetPosition in the presentation compiler #8807

Open
@scabug

Description

@scabug

The presentation compiler reports the type-mismatch error at an offset position, causing the error annotation in the IDE to be just one character.

For example,

  val foo: List[Int] = List(1).map(_.toString)

Will issue the error at the application of map, using an offset position.

The alternative is to parse around that point in the IDE, but the proper solution would be to use a range position.

I investigated a bit and here's what I found:

  • the tree position is already an offset position at the point where the error is issued
  • the offset position is related to filled-in implicits. The following code shows the same positioning (though simpler example, with type parameters or not, position the error at a range)
  def bar(x: Int)(implicit imp: Int) = x
  
  implicit val impimp = 42  
  val sss: String = bar(1)

See also PR 759

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions