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

private primary constructor and new #6538

Closed
scabug opened this issue Oct 18, 2012 · 4 comments
Closed

private primary constructor and new #6538

scabug opened this issue Oct 18, 2012 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Oct 18, 2012

I'm learing Scala and was toying with private constructors. When compiling the following experiment I got the compiler error below:

package constructor

class NottyBits[T] (
  private var item1: T,
  private var item2: T
) {
  def get: (T, T) = (item1, item2)
  def set (i1: T, i2: T): Unit = {
    item1 = i1
    item2 = i2
  }
}

object Client {
  def main(args: Array[String]) = {
    val nb1 = new constructor.NottyBits[Int](19, 31)
  }
}

//The SBT builder crashed while compiling your project. This is a bug in the Scala compiler or SBT. Check the Erorr Log for details. The error message is: Unexpected New scala_exps Unknown Scala Problem

@scabug
Copy link
Author

scabug commented Oct 18, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6538?orig=1
Reporter: Miguel Pessoa Monteiro (mpm)

@scabug
Copy link
Author

scabug commented Oct 18, 2012

@paulp said:
Please be more attentive when opening issues. I know what bug you're trying to report and this source doesn't have it. Those are private constructor parameters, but that's not a private constructor. Move a private back a token.

It's fixed in 2.10.

@scabug scabug closed this as completed Oct 18, 2012
@scabug
Copy link
Author

scabug commented Oct 18, 2012

Miguel Pessoa Monteiro (mpm) said:
Just one note: the source was already out of date when I copy pasted it. If you place 'private' after NottyBits[T] you'll get the compiler error I mentioned.

@scabug
Copy link
Author

scabug commented Oct 18, 2012

@paulp said:
Yes, that's what "move private back a token" meant.

@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants