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

loading a file with a companion object using :load fails in the REPL #4684

Closed
scabug opened this issue Jun 9, 2011 · 4 comments
Closed

loading a file with a companion object using :load fails in the REPL #4684

scabug opened this issue Jun 9, 2011 · 4 comments

Comments

@scabug
Copy link

scabug commented Jun 9, 2011

Using Scala 2.9.0, the following code compiles when entering it in the REPL using :paste mode. However, saving it into a file and loading it in the REPL using :load, gives an error:

case class A(i1: Int, i2: Int)

object A {
  def apply(i: Int): A = A(i, i)
}
scala> :load A.scala
Loading A.scala...
defined class A
<console>:8: error: too many arguments for method apply: (i: Int)A in object A
         def apply(i: Int): A = A(i, i)

It looks like the lines in the file are loaded and interpreted one by one, which for companion object does not work in the in the REPL. It would be nice if this would work as well.

@scabug
Copy link
Author

scabug commented Jun 9, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4684?orig=1
Reporter: arjan blokzijl (arjanblokzijl)
Affected Versions: 2.9.0

@scabug
Copy link
Author

scabug commented Jul 1, 2013

@som-snytt said:
In the form :paste A.scala
scala/scala#2696

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
scala/scala#2719

@scabug
Copy link
Author

scabug commented Jul 12, 2013

@adriaanm said:
scala/scala#2725

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