Aladdin - Scala Bugtracking
[#144] project: compiler priority: low category: bug
submitter assigned to status date submitted
Matthias Martin fixed 2003-09-16 14:14:06.0
subject Repeated mixin inheritance
code
trait I;
class C with I with I;
what happened
Crashes the mixin expansion process:
Exception in thread "main" java.lang.AssertionError: I$class
        at scalac.symtab.SymbolSubstTypeMap.insertSymbol(SymbolSubstTypeMap.java:61)
        at scalac.transformer.ClassExpander.inlineMixin(ExpandMixins.java:96)
        at scalac.transformer.ExpandMixinsPhase.expandTemplate(ExpandMixinsPhase.java:118)
        at scalac.transformer.ExpandMixinsPhase.getExpandedTemplate(ExpandMixinsPhase.java:102)
        at scalac.transformer.ExpandMixinsPhase.access$112(ExpandMixinsPhase.java:35)
        at scalac.transformer.ExpandMixinsPhase$Expander.transform(ExpandMixinsPhase.java:154)
        at scalac.ast.Transformer.transform(Transformer.java:281)
        at scalac.ast.Transformer.apply(Transformer.java:67)
        at scalac.ast.Transformer.apply(Transformer.java:62)
        at scalac.transformer.ExpandMixinsPhase.apply(ExpandMixinsPhase.java:73)
        at scalac.Global.compile(Global.java:293)
        at scalac.Global.compile(Global.java:266)
        at scalac.Main.main(Main.java:32)
what expected Either a compile-time error (in this case maybe Martin should have a look at it), or ExpandMixin has to deal with the case properly.
[back to overview]
Changes of this bug report
Burak  edited on  2003-09-23 18:24:13.0
Michel  edited on  2003-09-30 14:57:55.0
I think that this should be forbidden. It's not really hard to handle in ExpandMixins, but since I cannot think of a useful application of such code, we should disallow it.

One argument for disallowing it is that Java disallows direct inheritance from one interface several times (indirect inheritance is of course OK, and also works correctly with the Scala compiler now). So, to generate valid Java code for this example, we would anyway have to remove the second occurence of I in the list of C's parents.

Martin  edited on  2003-10-08 21:06:30.0