Aladdin - Scala Bugtracking
[#361] project: compiler priority: high category: bug
submitter assigned to status date submitted
Martin Philippe fixed 2004-09-13 17:33:43.0
subject assertion violation in MakeBoxingExplicit
code
class Global with Trees; 

abstract class Trees: Global {

  abstract class Tree {
    var pos: int = 0;
  }

  object posAssigner {
    def atPos[T <: Tree](pos: int, tree: T): T = {
      tree.pos = pos; tree
    }
  }

  def atPos[T <: Tree](pos: int)(tree: T): T = posAssigner.atPos(pos, tree);
}
what happened
T < Tree[Global$class.this.type]?
  Tree[Trees$class.this.type] < Tree[Global$class.this.type]?
     < ?
    true
    Trees$class.this.type < Global$class.this.type?
      Trees$class.this.type = Global$class.this.type?
      false
    false
  false
  Tree[Trees$class.this.type] < Tree[Global$class.this.type]?
     < ?
    true
    Trees$class.this.type < Global$class.this.type?
      Trees$class.this.type = Global$class.this.type?
      false
    false
  false
false
Exception in thread "main" java.lang.AssertionError: 
unit        : selftypes.scala
clasz       : Global$class
member      : Global$class.atPos
owner       : Global$class.atPos
tree        : T
tree.pos    : 15:59
tree.symbol : null
tree.type   : T
expected    : Tree[Global$class.this.type]
	at scalac.checkers.TreeChecker.conforms(TreeChecker.java:431)
	at scalac.checkers.TreeChecker.conforms(TreeChecker.java:418)
	at scalac.checkers.TreeChecker.tapply(TreeChecker.java:320)
	at scalac.checkers.TreeChecker.expression(TreeChecker.java:286)
	at scalac.checkers.TreeChecker.member(TreeChecker.java:168)
	at scalac.checkers.TreeChecker.member(TreeChecker.java:135)
	at scalac.checkers.TreeChecker.template(TreeChecker.java:111)
	at scalac.checkers.TreeChecker.template(TreeChecker.java:91)
	at scalac.checkers.TreeChecker.check(TreeChecker.java:81)
	at scalac.transformer.MakeBoxingExplicitPhase.apply(MakeBoxingExplicitPhase.java:46)
	at scalac.Global.compile(Global.java:390)
	at scalac.Global.compile(Global.java:360)
	at scala.tools.scalac.Main$.main1(Main.scala:45)
	at scala.tools.scalac.Main$.main(Main.scala:28)
	at scala.tools.scalac.Main.main(Main.scala:28)
what expected Succesful compilation. It looks like somewhere a thisType() instead of a typeOfThis() is used.
[back to overview]
Changes of this bug report
Martin  edited on  2004-09-13 17:35:48.0
I noted that the problem does not arise if Global extends Trees instead of using it as a mixin. So the problem might well have to do with mixin composition.
Philippe  edited on  2004-09-13 19:16:12.0
A type parameter substitution was missing in ExpandMixins.