ソースを参照

[java] fix abstract overload implementation test

Simon Krajewski 10 年 前
コミット
c79054783c
2 ファイル変更7 行追加3 行削除
  1. 6 2
      tests/unit/src/unit/issues/Issue3388.hx
  2. 1 1
      typer.ml

+ 6 - 2
tests/unit/src/unit/issues/Issue3388.hx

@@ -6,11 +6,15 @@ private abstract A<T>(Array<T>) {
     }
 
 	#if java
-    @:overload static inline public function sum(a:A<Int>) {
+	@:impl
+    @:overload
+	static inline public function sum(a:Array<Int>) {
         return "sum of ints";
     }
 
-    @:overload static inline public function sum(a:A<String>) {
+    @:overload
+	@:impl
+	static inline public function sum(a:Array<String>) {
         return "sum of strings";
     }
 	#end

+ 1 - 1
typer.ml

@@ -1582,7 +1582,7 @@ and type_field ?(resume=false) ctx e i p mode =
 					| [] -> error (Printf.sprintf "Field %s cannot be called on %s" f.cf_name (s_type (print_context()) e.etype)) p
 					| cf :: cfl ->
 						match follow (apply_params a.a_params pl (monomorphs cf.cf_params cf.cf_type)) with
-							| TFun((_,_,t1) :: _,_) when type_iseq t1 e.etype ->
+							| TFun((_,_,t1) :: _,_) when type_iseq t1 (Abstract.get_underlying_type a pl) ->
 								cf
 							| _ ->
 								loop cfl