#364 NPE: curry handling

katox Sun 21 Sep 2008

There seems to be a bug in handling an errorneous input in resolveCurry method. This is the testcase:

class Main
{
|->Str| bar;

Void run(|->Str| fooF) {
  this.bar = fooF
  echo(&bar)   // "Invalid operand 'field' for curry operator"
  echo(&bar()) // NPE: Internal compiler error    
  echo("")
}

static Void main() {
  main := Main()
  main.run |->Str| { return "fooF" }
}
}

which gives following:

Main.fan(7,10): Invalid operand 'field' for curry operator
Main.fan(8,11): Expected method, not field 'hello::Main.bar'
Error:     Internal compiler error
sys::NullErr: java.lang.NullPointerException
  compiler::CurryResolver.genSignature (CurryResolver.fan:78)
  compiler::CurryResolver.resolve (CurryResolver.fan:49)
  compiler::ResolveExpr.resolveCurry (ResolveExpr.fan:583)
  compiler::ResolveExpr.resolveExpr (ResolveExpr.fan:164)
  compiler::ResolveExpr.visitExpr (ResolveExpr.fan:121)
  ...

I'm not sure about the resolution but it seems that CurryResolver initial asserts should be more strict.

brian Mon 22 Sep 2008

thanks for the bug report - I'll take a look next week

katox Mon 22 Sep 2008

No problem ;). I'd rather fix it...

brian Sun 2 Nov 2008

katox Sun 2 Nov 2008

verified

Login or Signup to reply.