2
0
Эх сурвалжийг харах

support field display without expressions

Simon Krajewski 9 жил өмнө
parent
commit
09b336ba2e

+ 1 - 1
src/typing/typeload.ml

@@ -2173,7 +2173,7 @@ module ClassInitializer = struct
 
 		match e with
 		| None ->
-			()
+			if fctx.is_display_field then check_field_display ctx (cf.cf_name_pos) cf;
 		| Some e ->
 			if requires_value_meta ctx.com (Some c) then cf.cf_meta <- ((Meta.Value,[e],null_pos) :: cf.cf_meta);
 			let check_cast e =

+ 3 - 0
tests/display/src/cases/Basic.hx

@@ -66,6 +66,8 @@ class Basic extends DisplayTestCase {
 
 		var x4(default, null) = "fo{-4-}";
 		static var x5(default, null) = "fo{-5-}";
+
+		static var x{-6-}6:String;
 	}
 	**/
 	function testFieldDisplay() {
@@ -74,6 +76,7 @@ class Basic extends DisplayTestCase {
 		eq("String", type(pos(3)));
 		eq("String", type(pos(4)));
 		eq("String", type(pos(5)));
+		eq("String", type(pos(6)));
 	}
 
 	/**