Aladdin - Scala Bugtracking
[#1172] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin won't fix 2007-06-10 16:05:08.0
subject false illegal cycle error in resident compiler
code
// two packages, last segment must be same name
// two Plugin classes in both packages, the classes must be the same name
// package lampion.eclipse
// Plugin.scala
package lampion.eclipse;
trait IProject
trait Plugin {
  type Project <: ProjectImpl
  trait ProjectImpl {
    def self : Project
    def xxx : Unit
  }
  val projects = new scala.collection.jcl.LinkedHashMap[IProject,Project]
}
// Nature.scala
package lampion.eclipse;
abstract class Nature {
  def plugin : Plugin
  def getProject : IProject
  def configure = {
    val plugin = this.plugin
    val project = plugin.projects(getProject)
    project.xxx
    ()
  }
}
// package scala.tools.eclipse
// Plugin.scala
package scala.tools.eclipse;
trait Plugin extends lampion.eclipse.Plugin {
  type Project <: ProjectImpl
  trait ProjectImpl extends super.ProjectImpl {
    def self : Project
    def yyy : Unit
  }
}
// Nature.scala
package scala.tools.eclipse;
abstract class Nature extends lampion.eclipse.Nature {
  override def plugin : Plugin
  override def configure = {
    super.configure
    val plugin = this.plugin
    val project = plugin.projects(getProject)
    project.yyy
    ()
  }
}

what happened
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/locker/bin/scalac -d ../bin/ -resident

nsc> scala/tools/eclipse/Nature.scala

nsc> scala/tools/eclipse/Nature.scala
scala/tools/eclipse/Nature.scala:9: error: illegal cyclic reference involving trait ProjectImpl
    project.yyy
           ^

nsc> 
what expected Seems like the compiler is getting confused with my package and class overloading. Changing the package names so the last segments don't match or the Plugin class names so they aren't the same avoids the bug.
[back to overview]
Changes of this bug report
Martin  edited on  2007-07-14 11:52:10.0
I don't think it's possible to fix this with the scheme we have.