dplassgit / d2lang

D2 is a strongly-typed, statically-typed, (mostly) inferred-type compiled language.
MIT License
6 stars 0 forks source link

Too much code is generated for comparing an array to (constant) null #359

Closed dplassgit closed 2 weeks ago

dplassgit commented 2 weeks ago

There's even a comment in ArrayCodeGenerator // WE DON"T NEED TO GENERATE ANY MORE CODE and then it goes on to generate more (unnecessary) code.

dplassgit commented 2 weeks ago

Weird, ArrayType is not compatible with Nulls, so we should never be comparing to null constants anyway, or making sure arrays aren't null... what's going on here?

dplassgit commented 2 weeks ago

I don't think it's feasible to prevent arrays from being null, so I'm going to allow it.