Skip to content

Error in rhs of identifier leads to spurious errors later on #2730

Closed
@smarter

Description

@smarter

This code should print one error but prints two:

object Test {
  def test: Unit = {
    val x = iDontExist(32) // error: not found: iDontExist
    val y = x
    x + x
    println(x)
  }
}
-- [E006] Unbound Identifier Error: try/nometh.scala:3:12 ----------------------
3 |    val x = iDontExist(32)
  |            ^^^^^^^^^^
  |            not found: iDontExist

longer explanation available when compiling with `-explain`
-- [E006] Unbound Identifier Error: try/nometh.scala:6:12 ----------------------
6 |    println(x)
  |            ^
  |            not found: iDontExist

longer explanation available when compiling with `-explain`

two errors found

Compare with the output you get with scalac:

try/nometh.scala:3: error: not found: value iDontExist
    val x = iDontExist(32)
            ^
one error found

This is somewhat similar to #2412

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