When enabling null safety and accessing a not existing entry of an array.
Null is assigned to a non-nullable variable. Is this expected behavior?
If so, what is the point of null-safety in this case?
I would have expected either an exception is thrown (my preference) or Null<Int>
is the return type on array access.
@:nullSafety(StrictThreaded)
class Test {
static function main() {
final values:Array<Int> = [1];
final value:Int = values[10];
trace(value); // value is null
}
}