Skip to content

Use package object as value #1786

Closed
@liufengyun

Description

@liufengyun

Both scalac and dotty rejects following code with the error package meta is not a value :

package object meta {
  def apply(x: Int): Int = x * x
}

class Test {
  def f = meta {
    5 + 4
  }
}

As discussed with @xeno-by , it would be good to support this usage.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions