Skip to content

uninitialized accepted, but _ isn't #22614

Open
@durban

Description

@durban

Compiler version

3.3.5

Minimized code

This works:

package com.example

class Foo {
  var bar: String =
    scala.compiletime.uninitialized
}

But this doesn't:

package com.example

class Foo {
  var bar: String =
    _
}

Output

[error] -- [E017] Syntax Error: ...
[error] 5 |    _
[error]    |    ^
[error]    |    Unbound placeholder parameter; incorrect use of _
[error]    |
[error]    | longer explanation available when compiling with `-explain`
[error] one error found

Expectation

I expected both to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions