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

Fix #11180 (#11189)

* [tests] add test for #11180

* fix 11180
Rudy Ges 2 жил өмнө
parent
commit
385ab5af54

+ 1 - 1
src/optimization/optimizer.ml

@@ -358,7 +358,7 @@ let rec reduce_loop ctx e =
 				begin match cf.cf_expr with
 				| Some {eexpr = TFunction tf} ->
 					let config = inline_config (Some cl) cf el e.etype in
-					let rt = (match follow e1.etype with TFun (_,rt) -> rt | _ -> die "" __LOC__) in
+					let rt = (match Abstract.follow_with_abstracts e1.etype with TFun (_,rt) -> rt | _ -> die "" __LOC__) in
 					let inl = (try type_inline ctx cf tf ef el rt config e.epos false with Error { err_message = Custom _ } -> None) in
 					(match inl with
 					| None -> reduce_expr ctx e

+ 15 - 0
tests/misc/projects/Issue11180/Main.hx

@@ -0,0 +1,15 @@
+class Main {
+	static function main() {
+		trace(Abs.use(fn)(101));
+	}
+
+	inline static function fn(v:Int):Int
+		return v;
+}
+
+@:callable abstract Abs<T>(T->Int) from T->Int {
+	inline public static function use<T>(fn:T->Int):Abs<T> {
+		return fn;
+	}
+}
+

+ 1 - 0
tests/misc/projects/Issue11180/compile.hxml

@@ -0,0 +1 @@
+-main Main