Skip to content

Use package object as value #1786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
liufengyun opened this issue Dec 12, 2016 · 0 comments · Fixed by #1787
Closed

Use package object as value #1786

liufengyun opened this issue Dec 12, 2016 · 0 comments · Fixed by #1787

Comments

@liufengyun
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants