@@ -1 +1 @@
-Subproject commit 8dbe1ee1ae4b31e7b605f24805d26bda9c701982
+Subproject commit 0e6ea857c0f7df5e69628f949d0d33a3ce5552a8
@@ -129,7 +129,7 @@ and mark_field dce c cf stat =
end else
add cf;
if not stat then
- match c.cl_constructor with
+ match c.cl_constructor && is_physical_var_field cf with
| None -> ()
| Some ctor -> mark_field dce c ctor false
end
@@ -770,6 +770,12 @@ let extract_field = function
| FAnon f | FInstance (_,_,f) | FStatic (_,f) | FClosure (_,f) -> Some f
| _ -> None
+let is_physical_var_field f =
+ match f.cf_kind with
+ | Var { v_read = AccNormal | AccInline | AccNo } | Var { v_write = AccNormal | AccNo } -> false
+ | Var _ -> not (Meta.has Meta.IsVar f.cf_meta)
+ | _ -> false
+
let is_extern_field f =
match f.cf_kind with
| Method _ -> false
@@ -0,0 +1,15 @@
+package unit.issues;
+class Issue6807 extends unit.Test {
+ function test() {
+ #if (dce != 'no')
+ t(null == Type.resolveClass('unit.issues._Issue6807.ShouldBeRemovedByDce'));
+ #end
+ }
+}
+private class ShouldBeRemovedByDce {
+ public var a = 0;
+ public var b(get,never):Int;
+ function get_b() return 0;