bug?

17 views
Skip to first unread message

mdvo...@gmail.com

unread,
Nov 15, 2016, 4:41:51 PM11/15/16
to yeti-lang
Hello,

Yeti 0.9.9.1+ REPL.

> s = { n=1, get n2 () = n*2 }
Exception in thread "main" java.lang.NullPointerException
        at code$0.get(<>)
        at yeti.lang.AStruct.toString(AStruct.java:110)
        at yeti.lang.Core.show(Core.java:168)
        at yeti.lang.compiler.eval$evaluateYetiCode$.bindings(eval.yeti:522)
        at yeti.lang.compiler.eval$evaluateYetiCode$$0.get(eval.yeti:541)
        at yeti.lang.compiler.eval$evaluateYetiCode$$0.get(eval.yeti)
        at yeti.lang.compiler.yeti.repl(yeti.yeti:59)
        at yeti.lang.compiler.yeti.main(yeti.yeti:217)

If n is declared as var, everything is OK.

> s = { var n=1, get n2 () = n*2 }
s is {var n is number, n2 is number} = {n=1, n2=2}

Apparently accessors cannot reference non-var fields.

regards,
Martin Dvorak

Madis Janson

unread,
Nov 15, 2016, 4:46:57 PM11/15/16
to yeti-lang

On Tue, 15 Nov 2016, mdvo...@gmail.com wrote:

> Hello,
>
> Yeti 0.9.9.1+ REPL.
>
> > s = { n=1, get n2 () = n*2 }
> Exception in thread "main" java.lang.NullPointerException
>         at code$0.get(<>)
>         at yeti.lang.AStruct.toString(AStruct.java:110)
>
> If n is declared as var, everything is OK.
>
> > s = { var n=1, get n2 () = n*2 }
> s is {var n is number, n2 is number} = {n=1, n2=2}
>
> Apparently accessors cannot reference non-var fields.

Thank you for reporting, definitly a bug (or two).
I'll look into it.

Madis Janson

unread,
Nov 16, 2016, 1:33:30 AM11/16/16
to yeti-lang
Should be fixed now, constant field references in accessors got optimized into broken code.
Reply all
Reply to author
Forward
0 new messages