Skip to content

Dead code in RefCheck for "forward reference in constructor error" #3559

@vitorsvieira

Description

@vitorsvieira

Scalac issues "forward reference not allowed from self constructor invocation" while dotc issues a different message. (RefCheck:874).

With scalac:

class A(a: Any) {
  def this() = {
    this(b)             //forward reference not allowed from self constructor invocation
    def b = new {}
  }
}

With dotty:

Starting dotty REPL...
scala> class A(a: Any) {
           def this() = {
             this(b)
             def b = new {}
           }
         }
3 |      this(b)
  |           ^
  |           not found: b

Ev: https://scastie.scala-lang.org/lnrxIGq3SUCpoCXpUw3yGA

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