Aladdin - Scala Bugtracking
[#111] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Philippe fixed 2003-09-09 11:57:08.0
subject Illegal use of type selector crashes compiler
code
class H[A] {
  def mk():H#H[A] = {
    new H{};
  } 
}
what happened
Compiler chrash:
H.scala:2: class H takes type parameters.
  def mk():H#H[A] = {
           ^
Exception in thread "main" java.lang.AssertionError: field selector of class SelectFromType is not of kind Type,\
 found: scalac.util.Name()
        at scalac.checkers.CheckTreeNodes.check(CheckTreeNodes.java:710)
        at scalac.checkers.CheckTreeNodes.checkNode(CheckTreeNodes.java:815)
        at scalac.ast.Tree$SelectFromType.(Tree.java:451)
        at scalac.ast.Tree$ExtSelectFromType.(Tree.java:1182)
        at scalac.ast.DefaultTreeFactory.SelectFromType(DefaultTreeFactory.java:318)
        at scalac.ast.StrictTreeCopier.SelectFromType(StrictTreeCopier.java:400)
        at scalac.ast.LazyTreeCopier.SelectFromType(LazyTreeCopier.java:522)
        at scalac.typechecker.Analyzer.transformSelect(Analyzer.java:1494)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2436)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1753)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2454)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1753)
        at scalac.typechecker.Analyzer.defineSym(Analyzer.java:1036)
        at scalac.typechecker.Analyzer$LazyTreeType.complete(Analyzer.java:639)
        at scalac.symtab.Symbol.info(Symbol.java:736)
        at scalac.symtab.Symbol.initialize(Symbol.java:702)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1782)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1753)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1556)
        at scalac.typechecker.Analyzer.transformTemplate(Analyzer.java:1615)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1820)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1753)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1556)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:111)
        at scalac.ast.Transformer.apply(Transformer.java:62)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:59)
        at scalac.typechecker.AnalyzerPhase.apply(AnalyzerPhase.java:107)
        at scalac.Global.compile(Global.java:293)
        at scalac.Global.compile(Global.java:266)
        at scalac.Main.main(Main.java:32)
what expected An error message telling me that the first H in H#H[A] is not a type or something simmilar... not a crash.
[back to overview]
Changes of this bug report
Martin  edited on  2003-09-09 13:41:48.0
The problem is in the TreeCopier routine
SelectFromType(tree, sym, qual)
If `sym' is Symbol.ERROR, the name of the created tree should be
.toTypeName()
, but it is the term name
.
Philippe  edited on  2003-09-09 16:48:15.0
Changed class Name so that ERROR responds true to both isTermName() and isTypeName().