Aladdin - Scala Bugtracking
[#169] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Martin fixed 2003-10-01 12:23:39.0
subject Typechecker crashes on bad program
code
import scala.concurrent.Process._;

class D() {
 def start_listener(Child:Process) = {
    var running = true;	
    while (running) {
      receiveWithin(0) {
        case TIMEOUT() => {
	    Child ! 'foo;
        }
      }
    }
  }
}
what happened
This incorrect program crashes the compiler:
>scalac -d classes D.scala 
D.scala:8: not found: type TIMEOUT
        case TIMEOUT() => {
             ^
D.scala:9: value ! is not a member of java.lang.Process
            Child ! 'foo;
                  ^
java.lang.NullPointerException
        at scalac.typechecker.Infer$Substituter$18.matches(Infer.java:87)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:120)
        at scalac.ast.Transformer.transform(Transformer.java:206)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:139)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:332)
        at scalac.ast.Transformer.transform(Transformer.java:172)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:276)
        at scalac.ast.Transformer.transform(Transformer.java:206)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:112)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:276)
        at scalac.ast.Transformer.transform(Transformer.java:143)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:271)
        at scalac.ast.Transformer.transform(Transformer.java:85)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:276)
        at scalac.ast.Transformer.transform(Transformer.java:156)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.ast.Transformer.transform(Transformer.java:276)
        at scalac.ast.Transformer.transform(Transformer.java:206)
        at scalac.typechecker.Infer$Substituter.transform(Infer.java:156)
        at scalac.typechecker.Infer$Substituter.apply(Infer.java:91)
        at scalac.typechecker.Infer.mkTypeApply(Infer.java:717)
        at scalac.typechecker.Infer.exprInstance(Infer.java:780)
        at scalac.typechecker.Analyzer.adapt(Analyzer.java:1204)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1730)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1745)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1911)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1730)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2023)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1730)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2440)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1730)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1913)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1730)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1745)
        at scalac.typechecker.Analyzer.defineSym(Analyzer.java:1027)
        at scalac.typechecker.Analyzer$LazyTreeType.complete(Analyzer.java:629)
        at scalac.symtab.Symbol.info(Symbol.java:752)
        at scalac.symtab.Symbol.initialize(Symbol.java:718)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1778)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1749)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1552)
        at scalac.typechecker.Analyzer.transformTemplate(Analyzer.java:1611)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1816)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1749)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1552)
        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 Error messages but not a NullPointerException...
[back to overview]
Changes of this bug report
Matthias  edited on  2003-10-03 11:56:43.0
Martin  edited on  2003-10-09 12:27:10.0