null pointer exception in compiler

25 views
Skip to first unread message

Chris Cannam

unread,
May 4, 2014, 7:29:47 AM5/4/14
to yeti...@googlegroups.com
Primitive array casts again:

> x = [[1],[2],[3]] as ~float[][]
x is float[][] = [[F@11e3c55,[F@b1b14,[F@11ef262]
> map list x
java.lang.NullPointerException
at yeti.lang.compiler.JavaType.isSafeCast(JavaType.java:751)
at yeti.lang.compiler.YetiAnalyzer.apply(YetiAnalyzer.java:497)
at
yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:171)
at
yeti.lang.compiler.YetiAnalyzer.toCode(YetiAnalyzer.java:1604)
at yeti.lang.compiler.Compiler.compile(Compiler.java:473)
etc
> map do i: list x[i] done [0..length x]
java.lang.NullPointerException
at yeti.lang.compiler.JavaType.isSafeCast(JavaType.java:751)
at yeti.lang.compiler.YetiAnalyzer.apply(YetiAnalyzer.java:497)
at
yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:171)
at yeti.lang.compiler.YetiAnalyzer.list(YetiAnalyzer.java:1406)
at
yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:115)
at yeti.lang.compiler.YetiAnalyzer.apply(YetiAnalyzer.java:494)
at
yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:171)
at
yeti.lang.compiler.YetiAnalyzer.toCode(YetiAnalyzer.java:1604)
at yeti.lang.compiler.Compiler.compile(Compiler.java:473)
etc
> map do i: list x[i] done [0..2]
[[1.0],[2.0],[3.0]] is list<list<number>>
>


Chris

Madis

unread,
May 4, 2014, 7:57:58 PM5/4/14
to yeti...@googlegroups.com

On Sun, 4 May 2014, Chris Cannam wrote:

> Primitive array casts again:
>
>> x = [[1],[2],[3]] as ~float[][]
> x is float[][] = [[F@11e3c55,[F@b1b14,[F@11ef262]
>> map list x
> java.lang.NullPointerException
> at yeti.lang.compiler.JavaType.isSafeCast(JavaType.java:751)
> at yeti.lang.compiler.YetiAnalyzer.apply(YetiAnalyzer.java:497)
> at
> yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:171)
> at
> yeti.lang.compiler.YetiAnalyzer.toCode(YetiAnalyzer.java:1604)
> at yeti.lang.compiler.Compiler.compile(Compiler.java:473)
> etc

Should be fixed now. This example gives type error now (allowing it
would be more work).

>> map do i: list x[i] done [0..length x]

This works with range [0..length x - 1].

>> map do i: list x[i] done [0..2]
> [[1.0],[2.0],[3.0]] is list<list<number>>

Alternative would be:

> flip map (list x) (as list<number>)
[[1.0],[2.0],[3.0]] is list<list<number>>

The flip is used to reverse the map arguments, making it easier for type
inferencer to work out the as cast type.

Chris Cannam

unread,
May 8, 2014, 7:51:55 AM5/8/14
to yeti...@googlegroups.com


On Mon, May 5, 2014, at 12:57 AM, Madis wrote:
>
> Should be fixed now.

And it was, thanks.


Chris
Reply all
Reply to author
Forward
0 new messages