Aladdin - Scala Bugtracking
[#375] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Philippe fixed 2004-11-12 14:03:55.0
subject method of same name as constr.arg. in case class
code
case class Foo(s: String) {
  def s(): String = s;
}
what happened
Exception in thread "main" scalac.ApplicationError:  no method $eq$eq of required kind among (scala.Any)scala.Bo\
olean at Foo.this.s.type
	at scala.tools.scalac.typechecker.RefCheck$class.scala$tools$scalac$typechecker$RefCheck$getUnaryMemberMethod(R\
efCheck.scala:652)
	at scala.tools.scalac.typechecker.RefCheck$class.scala$tools$scalac$typechecker$RefCheck$eqOp$0(RefCheck.scala:\
785)
	at scala.tools.scalac.typechecker.RefCheck$class.scala$tools$scalac$typechecker$RefCheck$equalsMethod(RefCheck.\
scala:794)
	at scala.tools.scalac.typechecker.RefCheck$class.scala$tools$scalac$typechecker$RefCheck$addSyntheticMethods(Re\
fCheck.scala:871)
	at scala.tools.scalac.typechecker.RefCheck$class.transform(RefCheck.scala:1031)
	at scala.tools.scalac.typechecker.RefCheck$class.transformStat(RefCheck.scala:1014)
	at scala.tools.scalac.typechecker.RefCheck$class.transformStats(RefCheck.scala:973)
	at scala.tools.scalac.typechecker.RefCheck$class.apply(RefCheck.scala:67)
	at scala.tools.scalac.typechecker.RefCheckPhase$class.apply(RefCheckPhase.scala:25)
	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 error "double declaration ... have same types after erasure". This is the behaviour when compiling "class Foo(val s:String) { def s():String = s; }"
[back to overview]
Changes of this bug report
Burak  edited on  2004-11-12 14:10:01.0
Martin  edited on  2004-11-19 17:36:03.0
The problem seems to be in gen.Select, which calls Type.memberStabilizedType, which in turn calls singleType. What happens is that we create a reference
that1.s
where s is an alternative of a symbol that is overloaded. Here, Type.singleType will do a *rebind* of the symbol. The rebind "snaps back from the alternative to the overloaded symbol. This should not happen.
Martin  edited on  2004-11-19 18:27:37.0
I fixed it by changing singleType.