瀏覽代碼

Make the generic interface extern if the original class is extern as well

Closes #4457
Cauê Waneck 10 年之前
父節點
當前提交
e606373482
共有 2 個文件被更改,包括 21 次插入0 次删除
  1. 1 0
      gencommon.ml
  2. 20 0
      tests/unit/src/unit/issues/Issue4457.hx

+ 1 - 0
gencommon.ml

@@ -4846,6 +4846,7 @@ struct
 						| TClassDecl ({ cl_params = hd :: tl } as cl) when set_hxgeneric gen md ->
 							let iface = mk_class cl.cl_module cl.cl_path cl.cl_pos in
 							iface.cl_array_access <- Option.map (apply_params (cl.cl_params) (List.map (fun _ -> t_dynamic) cl.cl_params)) cl.cl_array_access;
+							iface.cl_extern <- cl.cl_extern;
 							iface.cl_module <- cl.cl_module;
 							iface.cl_meta <-
 								(Meta.HxGen, [], cl.cl_pos)

+ 20 - 0
tests/unit/src/unit/issues/Issue4457.hx

@@ -0,0 +1,20 @@
+package unit.issues;
+
+private class A {
+	public function new() {}
+}
+
+@:generic
+private class B<T:{function new():Void;}> extends A {
+}
+
+class Issue4457 extends Test
+{
+
+	public function test()
+	{
+		new B<A>();
+	}
+
+}
+