Skip to content

"is not a class type" error for given for intersection type #14175

Closed
@user753

Description

@user753

Compiler version

3.1.0

Minimized example

trait Foo:
  def foo: Int

trait Bar:
  def bar: Int  

given (Foo & Bar) with
  def foo = 1
  def bar = 2

Output

compilation error

Foo & Bar is not a class type

Expectation

I think something like

Intersection type cannot be used with given

would be clearer

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions