Skip to content

Experimental trait cannot be instantiated anonymously #13091

Closed
@prolativ

Description

@prolativ

Compiler version

3.0.3-RC1-bin-20210715-7899462-NIGHTLY

Minimized code

import annotation.experimental
@experimental trait Foo
val foo = new (Foo @experimental) {}

Output

-- Error:
3 |val foo = new (Foo @experimental) {}
  |          ^
  |    extension of experimental trait Foo must have @experimental annotation

Expectation

It should be possible to create an instance of a trait marked as experimental without having to create a helper class like

@experimental class Bar extends Foo
val bar = new Bar

The problem seems to also affect classes with a refinement.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions