Skip to content

Make Parser.errorTerm return a tree with Error type #5865

@odersky

Description

@odersky

Right now, it returns null. This can cause annoying follow-on errors, which have become more frequent since we sharpened equality checking with null. See 8fca13d.

The right thing to do would be to let errorTerm return a tree with an ErrorType. I tried that, but, unfortunately, it breaks SignatureHelpTest in a way I cannot fix. So it would be good if somebody with more IDE knowledge could take this on. Here's what you need to do.

  1. Change errorTermTree in Parser.scala from
    def errorTermTree: Literal = atSpan(in.offset) { Literal(Constant(null)) }

to

    def errorTermTree: Tree = atSpan(in.offset) {
      TypedSplice(Literal(Constant(null)).withType(Types.UnspecifiedErrorType))
    }
  1. Fix the resulting breakage in SignatureHelp tests. It might be a test failure, or it might be an underlying failure in signatureHelp that somehow assumes that error trees have type Null.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions