Skip to content

No colon for you! in guard expression #25002

@som-snytt

Description

@som-snytt

Compiler version

3.8

Minimized code

//> using scala 3.8.0
def g(op: Int ?=> Boolean) = op(using 42)

def f(x: Any) =
  x match
  //case s: String if g(s.length > 4) => println(s)
  case s: String if g:
    s.length > 4
  => s
  case x => x.toString

@main def main =
  println:
    f("hello, world")

Output

8 |    s.length > 4
  |    ^
  |    indented definitions expected, identifier s found

Expectation

Scala continues its tradition of clean syntax excellence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions