Closed
Description
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 :
package fr.up5.mi.noel.scala
object Test {
def make(t: java.Test) : Test = TestList(t.args.toList)
}
case class TestList[T](elements: List[T])(implicit f: T => Test)
Java code :
package java;
public class Test {
public Test[] args;
}
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 :
Test.scala:4: error: not found: type Test
def make(t: java.Test) : Test = TestList(t.args.toList)
^
Test.scala:7: error: type Nothing is not a member of package fr.up5.mi.noel.scala
case class TestList[T](elements: List[T])(implicit f: T => Test)
^
Test.scala:7: error: type Function1 is not a member of package fr.up5.mi.noel.scala
case class TestList[T](elements: List[T])(implicit f: T => Test)
^
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.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.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.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.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.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.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)
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 :)