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

value class compiler crash with private[this] #7019

Closed
scabug opened this issue Jan 24, 2013 · 5 comments
Closed

value class compiler crash with private[this] #7019

scabug opened this issue Jan 24, 2013 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jan 24, 2013

I'm able to crash the compiler with the following code.

package foo

object Foo {
  final class Foo(val i: Int) extends AnyVal {
    def foo() = go(i)
    private[this] def go(i: Int) = i * 2
  }
}

Taking the [this] modifier off allows the code to fully compile.

[info] Compiling 1 Scala source to
/home/adam/src/default-project/target/scala-2.10/classes...
[error]
[error] while compiling:
/home/adam/src/default-project/src/main/scala/Code.scala
[error] during phase: extmethods
[error] library version: version 2.10.0
[error] compiler version: version 2.10.0
[error] reconstructed args: -classpath
/home/adam/src/default-project/target/scala-2.10/classes -d
/home/adam/src/default-project/target/scala-2.10/classes
-bootclasspath /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/netx.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/plugin.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/modules/jdk.boot.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/classes:/home/adam/.sbt/0.12.1/boot/scala-2.10.0/lib/scala-library.jar
[error]
[error] last tree to typer: Select(This(object Foo), Foo)
[error] symbol: object Foo in object Foo (flags:
)
[error] symbol definition: object Foo
[error] tpe: foo.Foo.Foo.type
[error] symbol owners: object Foo -> object Foo -> package foo
[error] context owners: method go -> class Foo -> object Foo ->
package foo
[error]
[error] == Enclosing template or block ==
[error]
[error] Apply( // val : in class , tree.tpe=
[error] Foo.this."Foo"."go$extension" // val : in
class , tree.tpe=
[error] This("Foo")final implicit class Foo extends AnyVal in object Foo
[error] )
[error]
[error] == Expanded type of tree ==
[error]
[error] TypeRef(
[error] pre = ThisType(object Foo)
[error] TypeSymbol(class Foo extends AnyRef)
[error] )
[error]
[error] uncaught exception during compilation:
scala.reflect.internal.Types$TypeError
[trace] Stack trace suppressed: run last compile:compile for the full output.
[error] (compile:compile) scala.reflect.internal.Types$TypeError:
method go$extension in object Foo cannot be accessed in object
foo.Foo.Foo
[error] Total time: 2 s, completed Jan 22, 2013 8:29:03 PM

@scabug
Copy link
Author

scabug commented Jan 24, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7019?orig=1
Reporter: Adam Shannon (adamdecaf)
Affected Versions: 2.10.0, 2.10.4, 2.11.0, 2.11.2
See #6215

@scabug
Copy link
Author

scabug commented Jan 31, 2013

@retronym said:
Relates to #6215, I feel it might be a direct duplicate of another ticket, but a cursory search doesn't reveal it.

@scabug
Copy link
Author

scabug commented Jan 30, 2014

Yuta Okamoto (okapies) said (edited on Jan 30, 2014 4:44:27 PM UTC):
The issue hasn't been fixed yet in 2.10.3. https://gist.github.com/okapies/8705976

@scabug
Copy link
Author

scabug commented Oct 14, 2014

@adriaanm said:
Since 2.11.4 is high priority, we should defer this until 2.11.5

@scabug
Copy link
Author

scabug commented Nov 6, 2014

@retronym said:
scala/scala#4096

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