소스 검색

add Unit constructor

Simon Krajewski 5 달 전
부모
커밋
9537ebd2cd
2개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 2
      std/haxe/Unit.hx
  2. 5 5
      tests/unit/src/unitstd/haxe/Unit.unit.hx

+ 3 - 2
std/haxe/Unit.hx

@@ -25,5 +25,6 @@ package haxe;
 /**
 	A unit type which can only be `null` at run-time.
 **/
-@:nullable
-enum Unit {}
+enum Unit {
+	Unit;
+}

+ 5 - 5
tests/unit/src/unitstd/haxe/Unit.unit.hx

@@ -1,9 +1,9 @@
-var u:haxe.Unit = null;
+var u:haxe.Unit = Unit;
 Reflect.isObject(u) == false;
-Reflect.isEnumValue(u) == false;
+Reflect.isEnumValue(u) == true;
 Reflect.isFunction(u) == false;
-Reflect.compare(u, null) == 0;
-Reflect.compare(null, u) == 0;
+Reflect.compare(u, haxe.Unit.Unit.Unit) == 0;
+Reflect.compare(haxe.Unit.Unit.Unit, u) == 0;
 Reflect.compare(u, u) == 0;
 Type.getClass(u) == null;
-Type.getEnum(u) == null;
+Type.getEnum(u) == haxe.Unit;