Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V8019. Two or more equivalent...
menu mobile close menu
Additional information
toggle menu Contents

V8019. Two or more equivalent expressions are specified inside the case expression list.

Apr 03 2026

The analyzer detected equivalent expressions for the same case within the switch statement.

The example:

switch {
  case s == "start", s == "start":
    Start()
  case s == "stop":
    Stop()
}

Using equivalent expressions likes == "start" makes no sense.

  • If the first expression evaluates to true, control flow enters the branch, bypassing the second expression.
  • If the first expression evaluates to false, the second expression will evaluate the same way, and control flow will skip this entire branch.

Most likely, this is a typo, and the second equivalent expression should be something else.

The fixed code:

switch {
  case s == "start", s == "begin":
    Start()
  case s == "stop":
    Stop()
}