Skip to content

Missing warning for invalid recursive val. #14429

Closed
@Swoorup

Description

@Swoorup

Compiler version

3.1.1

Minimized code

val a: Int = a

https://scastie.scala-lang.org/9Naw4C8JRuKQtPd0VXBXLw

No warnings or compilation errors

Expectation

Compiler error or warning.
Scala 2 gives value a in object Playground does nothing other than call itself recursively

Without warning, this is easy to create bugs like this. For eg:

 def create[F[_], S](using enc: Encoder[S])(state: S, fsm: FSM[F, S, Cmd, Option[Stat]]) =
    new Stat[F]:
      val state = state
      val fsm   = fsm

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcitype:bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions