RealyUniqueName / Safety

Null safety for Haxe
MIT License
54 stars 5 forks source link

Safety: Cannot assign nullable value to not-nullable variable in self-referencing lambda #18

Closed restorer closed 5 years ago

restorer commented 6 years ago
class Bug13 {
    public function bug() : Void {
        function cb() : Void {
            // Safety: Cannot assign nullable value to not-nullable variable.
            // Even with `cb.sure()` or `cb.unsafe()`
            js.Browser.window.setTimeout(cb, 1000);
        }
    }
}

See https://github.com/restorer/haxe-safety-bugs/blob/master/safetybugs/Main.hx#L172 for working example.

restorer commented 6 years ago

This is for Haxe 4.0.0-preview.5 and Safety from master.

RealyUniqueName commented 5 years ago

Fixed in https://github.com/HaxeFoundation/haxe/pull/7717