compiler exception in typedef

2 views
Skip to first unread message

Chris Cannam

unread,
Feb 12, 2013, 7:17:10 AM2/12/13
to yeti-lang
I don't expect this syntax is legal, but I'm sure it shouldn't crash
the compiler!

Yeti 0.9.7+ REPL.

> typedef t1 = A number | B number; typedef t2 = C number | t1
java.lang.ArrayIndexOutOfBoundsException: 0
at yeti.lang.compiler.YetiAnalyzer.nodeToMembers(YetiAnalyzer.java:250)
at yeti.lang.compiler.YetiAnalyzer.nodeToType(YetiAnalyzer.java:305)
at yeti.lang.compiler.YetiAnalyzer.bindTypeDef(YetiAnalyzer.java:941)
at yeti.lang.compiler.YetiAnalyzer.analSeq(YetiAnalyzer.java:1075)
at yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:91)
at yeti.lang.compiler.YetiAnalyzer.toCode(YetiAnalyzer.java:1794)
at yeti.lang.compiler.Compiler.compile(Compiler.java:471)
at yeti.lang.compiler.eval$evaluateYetiCode$._1(eval.yeti:462)
at yeti.lang.compiler.eval$evaluateYetiCode$._0(eval.yeti)
at yeti.lang.compiler.eval$evaluateYetiCode$.apply(eval.yeti:455)
at yeti.lang.Fun2_.apply(Unknown Source)
at yeti.lang.compiler.yeti.repl(yeti.yeti:58)
at yeti.lang.compiler.yeti.main(yeti.yeti:207)


Chris

Madis

unread,
Feb 12, 2013, 9:18:19 AM2/12/13
to yeti-lang

On Tue, 12 Feb 2013, Chris Cannam wrote:

> I don't expect this syntax is legal, but I'm sure it shouldn't crash
> the compiler!

I agree, should be fixed now (crashing). The priority of A x in type
expressions also changed, as the old behaviour was accidental and imho not
very good - for example 'is A number -> number' is now parsed as 'is
(A number) -> number'. Where the old behaviour was used, it should be now
written as 'is A (number -> number)'.

The syntax for merging variants is actually interesting idea (and probably
useful), it could be implemented later.
> --
> You received this message because you are subscribed to the Google Groups "yeti-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to yeti-lang+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages