forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typer] don't consider @:structInit + @:from when inferring
closes HaxeFoundation#11535
- Loading branch information
Showing
4 changed files
with
54 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package unit.issues; | ||
|
||
@:structInit | ||
private class BarImpl { | ||
public function new() {} | ||
} | ||
|
||
@:structInit | ||
private class FooImpl { | ||
public var x:Int; | ||
|
||
public function new(x:Int) { | ||
this.x = x; | ||
} | ||
} | ||
|
||
@:forward | ||
private abstract Foo(FooImpl) from FooImpl to FooImpl { | ||
public function new(x:Int) { | ||
this = new FooImpl(x); | ||
} | ||
|
||
@:from | ||
static public function fromVec4(v:BarImpl):Foo { | ||
return new Foo(1); | ||
} | ||
} | ||
|
||
class Issue11535 extends Test { | ||
function test() { | ||
var v:Foo = {x: 2}; | ||
eq(2, v.x); | ||
} | ||
} |