@@ -738,6 +738,13 @@
"platforms": ["flash"],
"internal": true
},
+ {
+ "name": "Nullable",
+ "metadata": ":nullable",
+ "doc": "Explicitly admits `null` as valid value for an enum, which affects null-safety",
+ "targets": ["TEnum"],
+ "links": ["https://haxe.org/manual/types-nullability.html"]
+ },
{
"name": "NullSafety",
"metadata": ":nullSafety",
@@ -85,6 +85,8 @@ let rec is_nullable_type ?(dynamic_is_nullable=false) = function
is_nullable_type (apply_typedef t tl)
| (TDynamic _) as t ->
dynamic_is_nullable && t == t_dynamic
+ | TEnum(en,_) ->
+ Meta.has Meta.Nullable en.e_meta
| _ ->
false
(*
@@ -25,4 +25,5 @@ package haxe;
/**
A unit type which can only be `null` at run-time.
**/
+@:nullable
enum Unit {}