-
Notifications
You must be signed in to change notification settings - Fork 21
Compiler crashes with "no-symbol does not have owner" #805
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-805?orig=1 |
@lrytz said: I can't reproduce your problem, I never get the An example that should compile but does not would be good. Also give us instructions on how to reproduce it (e.g. "call javac on Test.java, then scalac on ..."). Concerning your example: defining a scala object that has the same name as a java class is not supported. |
vector said: I modified my example to make it compilable, but that do not compile :) There is the java file, you put it in a file : BASEDIR/test/java/JavaTest.java package test.java;
public class TestJava {
public TestJava[] args;
} Now there is the scala file, you put it in a file : BASEDIR/test/scala/ScalaTest.scala package test.scala
import test.java.TestJava
case class TestScala(x: TestJava)
object TestScala {
implicit def javaToScala(x: TestJava) : TestScala = TestScala(x)
def make(t: TestJava) : TestList[TestJava] = t.args match {
case Array() => TestList(List())
case _ => TestList(t.args.toList)
}
}
case class TestList[T](elements: List[T])(implicit f: T => TestScala) After, you go in BASEDIR/ then you type : javac test/java/TestJava.java And I get this error : TestScala.scala:17: error: type Nothing is not a member of package test.scala
case class TestList[T](elements: List[T])(implicit f: T => TestScala)
^
TestScala.scala:17: error: type Function1 is not a member of package test.scala
case class TestList[T](elements: List[T])(implicit f: T => TestScala)
^
Exception in thread "main" java.lang.Error: no-symbol does not have owner
at scala.tools.nsc.symtab.Symbols$$NoSymbol$$.owner(Symbols.scala:1565)
at scala.tools.nsc.symtab.Symbols$$Symbol.fullNameString(Symbols.scala:1156)
at scala.tools.nsc.symtab.Symbols$$Symbol.fullNameString(Symbols.scala:1166)
at scala.tools.nsc.typechecker.Typers$$Typer.implicitManifest$$1(Typers.scala:3584)
at scala.tools.nsc.typechecker.Typers$$Typer.inferImplicit(Typers.scala:3593)
at scala.tools.nsc.typechecker.Typers$$Typer.implicitArg$$1(Typers.scala:3644)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:3648)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$applyImplicitArgs$$1.apply(Typers.scala:3648)
at scala.List.map(List.scala:798)
at scala.tools.nsc.typechecker.Typers$$Typer.applyImplicitArgs(Typers.scala:3648)
at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:644)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3233)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3276)
at scala.tools.nsc.typechecker.Typers$$Typer.typedCase(Typers.scala:1395)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedCases$$1.apply(Typers.scala:1414)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedCases$$1.apply(Typers.scala:1413)
at scala.List$$.loop$$1(List.scala:293)
at scala.List$$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$$Typer.typedCases(Typers.scala:1413)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3042)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3228)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3276)
at scala.tools.nsc.typechecker.Typers$$Typer.transformedOrTyped(Typers.scala:3325)
at scala.tools.nsc.typechecker.Typers$$Typer.typedDefDef(Typers.scala:1315)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2966)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3228)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3265)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1540)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.List$$.loop$$1(List.scala:293)
at scala.List$$.mapConserve(List.scala:310)
at scala.List$$.loop$$1(List.scala:297)
at scala.List$$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1165)
at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1063)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2960)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3228)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3265)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1540)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.List$$.loop$$1(List.scala:293)
at scala.List$$.mapConserve(List.scala:310)
at scala.List$$.loop$$1(List.scala:297)
at scala.List$$.mapConserve(List.scala:310)
at scala.List$$.loop$$1(List.scala:297)
at scala.List$$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2953)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3228)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3265)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1540)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1585)
at scala.List$$.loop$$1(List.scala:293)
at scala.List$$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1585)
at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2953)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3228)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3265)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analyzer.scala:40)
at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:257)
at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:243)
at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:243)
at scala.Iterator$$class.foreach(Iterator.scala:395)
at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:266)
at scala.tools.nsc.Global$$GlobalPhase.run(Global.scala:243)
at scala.tools.nsc.Global$$Run.compileSources(Global.scala:555)
at scala.tools.nsc.Global$$Run.compile(Global.scala:640)
at scala.tools.nsc.Main$$.process(Main.scala:84)
at scala.tools.nsc.Main$$.main(Main.scala:98)
at scala.tools.nsc.Main.main(Main.scala) And if you remove the "scala" in the package, it compiles. So I think it is only a problem with the scala package name ... |
@odersky said: |
Hello,
I encountered a bug with the compiler of version 2.7.1-rc2 and was able to reduce it to the following example :
Scala code :
Java code :
What is strange is :
The bug appears only when using "scala" in the package name, in conjunction with a java class (I think the array in the java class is important, I tried to reproduce the bug with a scala class instead of a java class and it did not appeared) and using implicit parameters for the TestList class !
The error is :
Note that this example doesn't mean anything and should not compile if there was not this bug, but at first I had an example that should work and that did not.
If you prefer that I make a better example that should compile, I can try to do it :)
The text was updated successfully, but these errors were encountered: