-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macro] Catch eval runtime failures when decoding (#11633)
* [eval] Catch runtime exceptions in safe_decode * [macro] narrow build macro eval failures to individual field (hacky...) * [tests] add test for 11632 * Less hacky way to retrieve haxe.macro.Field type * [tests] remove unneeded import
- Loading branch information
Showing
8 changed files
with
50 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#if macro | ||
import haxe.macro.Expr; | ||
#end | ||
|
||
#if !macro @:build(Macro.build()) #end | ||
class Main {} | ||
|
||
class Macro { | ||
public static function build() { | ||
var ct = TPath({pack: [], name: "Null", params: [TPType(null)]}); | ||
return (macro class { | ||
var foo:$ct; | ||
}).fields; | ||
} | ||
} |
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,6 @@ | ||
import sys.io.File; | ||
|
||
function main() { | ||
var dump = File.getContent("dump/decoding_error.txt"); | ||
Sys.println(dump); | ||
} |
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 @@ | ||
--main Main |
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 @@ | ||
Main.hx:5: characters 12-19 : Eval runtime exception: Null Access (see dump/decoding_error.txt for details) |
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 @@ | ||
--run Test |
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,14 @@ | ||
{ | ||
access: null | ||
doc: null | ||
kind: FVar(TPath({ | ||
name: Null | ||
pack: [] | ||
params: [TPType(null <- expected enum value)] | ||
sub: null | ||
}), null) | ||
meta: null | ||
name: foo | ||
pos: #pos | ||
} | ||
line 7: expected enum value |