Skip to content

Commit

Permalink
fix type parameter application when resolving unop overloads (closes H…
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Jun 30, 2015
1 parent cf099f9 commit 036dde6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/unit/src/unit/issues/Issue4357.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package unit.issues;

private abstract MyAbstract<T>(Array<T>) from Array<T> {
@:op(++A) public function pre()
return "pre";
}

class Issue4357 extends Test {
function test() {
var a:MyAbstract<Int> = [123];
eq("pre", ++a);
}
}
2 changes: 1 addition & 1 deletion typer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ and type_unop ctx op flag e p =
| [] -> raise Not_found
| (op2,flag2,cf) :: opl when op == op2 && flag == flag2 ->
let m = mk_mono() in
let tcf = apply_params c.cl_params pl (monomorphs cf.cf_params cf.cf_type) in
let tcf = apply_params a.a_params pl (monomorphs cf.cf_params cf.cf_type) in
if Meta.has Meta.Impl cf.cf_meta then begin
if type_iseq (tfun [apply_params a.a_params pl a.a_this] m) tcf then cf,tcf,m else loop opl
end else
Expand Down

0 comments on commit 036dde6

Please sign in to comment.