class NotABugButProposal6 {
private var s : Null<String>;
public function proposal() : Void {
s = ((Math.random() > 0.5) ? "A" : null);
if (s != null) {
// Safety: Cannot access "length" of a nullable value.
// While it makes sense in case of multithreading, is it possible to add something like `@:safety(threadsafe)`?
s.length;
}
}
}
See https://github.com/restorer/haxe-safety-bugs/blob/master/safetybugs/Main.hx#L95 for working example.