Skip to content

Top-level @experimental val _ = ... not considered experimental #20283

Open
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.4.0, 00802ab

Minimized code

@annotation.experimental
def method(): Unit = ()

@annotation.experimental
val _ = method()

Output

5 |val _ = method() // error but should not
  |        ^^^^^^
  |        method method is marked @experimental
  |
  |        Experimental definition may only be used under experimental mode:
  |          1. in a definition marked as @experimental, or
  |          2. compiling with the -experimental compiler flag, or
  |          3. with a nightly or snapshot version of the compiler.

Expectation

The error should not be emitted. The cause of this issue is the same as in #19807 (comment).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions