Created
May 1, 2013 16:09
-
-
Save back2dos/5496240 to your computer and use it in GitHub Desktop.
ECheckType and implicit conversion issue, haxe r6518
This file contains hidden or 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
| package ; | |
| abstract MyAbstract(Int) { | |
| public function new(v:Int) this = v; | |
| @:from static function fromString(s:String) return new MyAbstract(Std.parseInt(s)); | |
| } | |
| class Main { | |
| #if !macro | |
| static function main() { | |
| var d:Dynamic = test(); | |
| trace(Std.is(d, Int));//false | |
| var d:MyAbstract = test(); | |
| trace(Std.is(d, Int));//false | |
| var d:MyAbstract = '5'; | |
| trace(Std.is(d, Int));//true | |
| } | |
| #end | |
| macro static function test() { | |
| return { | |
| expr: haxe.macro.Expr.ExprDef.ECheckType(macro '5', macro: Main.MyAbstract), | |
| pos: haxe.macro.Context.currentPos() | |
| }; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment