Skip to content

Commit

Permalink
[typer] revert static extension abstract cast change for now
Browse files Browse the repository at this point in the history
see #5924
closes #7142
  • Loading branch information
Simn committed Jun 10, 2018
1 parent 2e1d98f commit 8fea07a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 26 deletions.
1 change: 0 additions & 1 deletion extra/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ XXXX-XX-XX: 4.0.0-preview.4

all : implemented `for` loop unrolling (#3784)
all : metadata can now use `.`, e.g. `@:a.b`. This is represented as a string (#3959)
all : [breaking] disallow static extensions through abstract field casts (#5924)
all : [breaking] disallow static extensions on implicit `this` (#6036)
js : added externs for js.Date (#6855)
js : respect `-D source-map` flag to generate source maps in release builds
Expand Down
2 changes: 1 addition & 1 deletion src/typing/fields.ml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ let rec using_field ctx mode e i p =
begin match follow t with
| TFun((_,_,(TType({t_path = ["haxe";"macro"],"ExprOf"},[t0]) | t0)) :: args,r) ->
if is_dynamic && follow t0 != t_dynamic then raise Not_found;
Type.unify e.etype t0;
let e = AbstractCast.cast_or_unify_raise ctx t0 e p in
(* early constraints check is possible because e.etype has no monomorphs *)
List.iter2 (fun m (name,t) -> match follow t with
| TInst ({ cl_kind = KTypeParameter constr },_) when constr <> [] && not (has_mono m) ->
Expand Down
21 changes: 0 additions & 21 deletions tests/misc/projects/Issue5924/Main.hx

This file was deleted.

2 changes: 0 additions & 2 deletions tests/misc/projects/Issue5924/compile-fail.hxml

This file was deleted.

1 change: 0 additions & 1 deletion tests/misc/projects/Issue5924/compile-fail.hxml.stderr

This file was deleted.

15 changes: 15 additions & 0 deletions tests/unit/src/unit/issues/Issue2152.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package unit.issues;

using unit.issues.misc.Issue2152Class;

private abstract MyInt(Int) {
public inline function new (x:Int) this = x;
@:to inline function toString ():String return "asString: " + this;
}

class Issue2152 extends Test {
function test() {
var z = new MyInt(1);
eq("asString: 1", z.passString());
}
}

0 comments on commit 8fea07a

Please sign in to comment.