Null safety isn't aware of map.exists which leads to warnings:
Main.hx
class Main {
static function main() {
var m = [1 => 2, 5 => 3];
for (c in 0...10) {
if (m.exists(c))
{
m[c]++;
}
else
{
m[c] = 0;
}
trace(m[c]);
}
}
}
build.hxml
-main Main
--interp
--macro nullSafety("Main", Strict)
Result
Main.hx:8: characters 5-11 : Null safety: Cannot assign nullable value here.
Main.hx:8: characters 5-11 : Null safety: Cannot perform binary operation on nullable value.
Main.hx:15: characters 10-14 : Null safety: Cannot pass nullable value to not-nullable argument "v" of function "trace".
Displayed 10 times (is the loop unrolled?)
Also we might want to make trace take a Null since trace(null); works fine.
Null safety isn't aware of map.exists which leads to warnings:
Main.hx
build.hxml
Result
Displayed 10 times (is the loop unrolled?)
Also we might want to make trace take a Null since
trace(null);works fine.