浏览代码

[php] use `follow_with_abstracts` (closes #4798)

Simon Krajewski 9 年之前
父节点
当前提交
2a6647818d
共有 2 个文件被更改,包括 20 次插入0 次删除
  1. 2 0
      genphp.ml
  2. 18 0
      tests/unit/src/unit/issues/Issue4798.hx

+ 2 - 0
genphp.ml

@@ -68,6 +68,8 @@ type context = {
 	mutable lib_path : string;
 	mutable lib_path : string;
 }
 }
 
 
+let follow = Abstract.follow_with_abstracts
+
 let join_class_path path separator =
 let join_class_path path separator =
 	let result = match fst path, snd path with
 	let result = match fst path, snd path with
 	| [], s -> s
 	| [], s -> s

+ 18 - 0
tests/unit/src/unit/issues/Issue4798.hx

@@ -0,0 +1,18 @@
+package unit.issues;
+
+private abstract Lazy<T>(Void->T) {
+	inline function new(r) this = r;
+
+	@:to public inline function get():T
+		return (this)();
+
+	@:from static inline function ofConst<T>(c:T)
+		return new Lazy(function () return c);
+}
+
+class Issue4798 extends Test {
+	public static var INIT: Lazy<String> = 'b';
+	function test() {
+		eq("b", (INIT: String));
+	}
+}