Aladdin - Scala Bugtracking
[#583] project: specification priority: medium category: missing feature
submitter assigned to status date submitted
Sean Martin fixed 2006-04-28 19:49:14.0
subject Overriding broken for private defs
code
See https://lampsvn.epfl.ch/svn-repos/scala/plugin/lampion SVN project
what happened
Test.scala does mixin composition to create class MyNode from OffsetNode and BasicTreeNode. Both of these classe\
s contain private set methods. Test.scala fails to compile with the following type error message:

Severity	Path	Resource	De5cr1p7-haX0Rion	Location	Creation Time	Id
Error	lampion/src/lampion/collections	Test.scala	error overriding method set in trait BasicNode of type (lampion\
.collections.DirX.Dir,Test.this.MyNode)Test.this.MyNode;
 method set in trait BasicTreeNode of type (lampion.collections.DirX.Dir,Test.this.MyNode)scala.Unit has weaker \
access privileges; it should at least be private[LinkedList]	line 15	April 28, 2006 7:45:15 PM	17987

what expected Both set methods are private and not visible in Test. They shouldn't conflict with each other.
[back to overview]
Changes of this bug report
Martin  edited on  2006-05-04 13:06:52.0
Unfortunately, the overridden method is private[LinkedList]. It's true that for Scala, this method is not visible in Test but for Java it is. So we do get a conflict on the JVM level.
Martin  edited on  2006-05-04 13:07:59.0
Sean  edited on  2006-05-04 13:51:55.0
Its really unfortunate that mixins its Scala aren't modular (compiled in a modular way) and it really limits how they can be used. In Jiazzi, we handled this through name mangling, a similar thing might work for Scala. How about, in Scala, all private methods are mangled according to their scope, e.g., private[LinkedList] def set becomes set$LinkedList. Of course, I can mangle my names manually if this is not easy to implement in the compiler.
Sean  edited on  2006-08-16 12:47:05.0
As discussed at the meeting this week, mangling the name of the private member with the private-specified qualifier will fix this issue.
Martin  edited on  2006-08-22 16:30:41.0
Should be fixed now.