Skip to content
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

Case class constructor inlining should not kick in for private constructors #9425

Closed
scabug opened this issue Jul 31, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 31, 2015

When compiling a case class with a private constructor, calling the apply method causes an error (to do too aggressive inlining).

scala> :paste
case class Foo private (x: Int)
Foo.apply(x)

<console>:10: error: constructor Foo in class Foo cannot be accessed in object $iw
              Foo.apply(5)
                  ^

I'd expect this to work the same when they are compiled together or separate, for example:

scala> case class Foo private(x: int)
defined class Foo

scala> Foo(5)
res5: Foo = Foo(5)

Possibly related #5304, #8821

@scabug
Copy link
Author

scabug commented Jul 31, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9425?orig=1
Reporter: @jsuereth
Affected Versions: 2.10.4, 2.11.7
See #5304, #8821

@scabug
Copy link
Author

scabug commented Jul 31, 2015

@retronym said:
scala/scala#4675

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

No branches or pull requests

2 participants