#2057 Internal compiler error

jantrtik Wed 14 Nov 2012

Hello,

I stumbled upon internal compiler error:

ERR: Internal compiler error
sys::NullErr: java.lang.NullPointerException
  compiler::Parser.closure (Parser.fan:2007)
  compiler::Parser.tryItBlock (Parser.fan:1993)
  compiler::Parser.typeBaseExpr (Parser.fan:1621)
  compiler::Parser.termBaseExpr (Parser.fan:1525)
  compiler::Parser.termExpr (Parser.fan:1500)
  compiler::Parser.termExpr (Parser.fan)
  compiler::Parser.unaryExpr (Parser.fan:1471)
  compiler::Parser.parenExpr (Parser.fan:1405)
  compiler::Parser.multExpr (Parser.fan:1390)
  compiler::Parser.addExpr (Parser.fan:1378)
  compiler::Parser.rangeExpr (Parser.fan:1361)
  compiler::Parser.relationalExpr (Parser.fan:1330)
  compiler::Parser.equalityExpr (Parser.fan:1296)
  compiler::Parser.condAndExpr (Parser.fan:1276)
  compiler::Parser.condOrExpr (Parser.fan:1256)
  compiler::Parser.ifExpr (Parser.fan:1208)
  compiler::Parser.assignExpr (Parser.fan:1189)
  compiler::Parser.assignExpr (Parser.fan)
  compiler::Parser.expr (Parser.fan:1178)
  compiler::Parser.collectionLiteralExpr (Parser.fan:1846)
  42 More...

Parser is unable to cope with code like this:

@Js
facet class SomeFacet
{
    const Property[] props
}

@Js
const class Property
{
    const Str name
    const [Str:Obj] conf := Str:Obj[:]
	
    new make(|This|? f)
    {
        if(f != null) f(this)
    }
}


**
** mixin 1
**
mixin Mixin1 
{
    abstract Str field
    abstract Str method()
}


@Js
@SomeFacet{props = [Property{name = "prop1"},]}
class Class1  
{
    static Void main()
    {
        echo("Hello World")
    }
}

Have a nice day, Jan

brian Wed 14 Nov 2012

thanks for reporting, I pushed a fix

jantrtik Wed 14 Nov 2012

Hello,

I tried fixed version and unfortunately I think that bug is still here. The code I posted as test case seems to me quite valid, but compiler now complains:

testcase.fan(26,26): Unexpected closure

I think there is bug in parser, because when I modify testcase like:

@Js
facet class Facet1{
	const Property[] props
}

@Js
const class Property{
	const Str name
	const [Str:Obj] conf := Str:Obj[:]
	
	new make(|This|? f){
		if(f != null)
			f(this)
	}
}

@Js
@Facet1{props = [Property{name = "prop1"},]}
class Class1  
{
  static Void main()
  {
      echo("Hello World")
  }
}

**
** mixin 1
**
mixin Mixin1 {
    abstract Str field
    abstract Str method()
}

everything works as expected... both testcases differs only in position of Mixin1 definition.

Have a nice day, Jan

Login or Signup to reply.