Description
Currently, you cannot deserialize JSON-formatted Rego IR instructions (such as what you'd see in a plan.json file), unless they include file location fields (file name index, row, col).
Example:
❌ This fails:
{"type":"AssignVarStmt","stmt":{"source":{"type":"local","value":2},"target":3}}
✅ This works:
{"type":"AssignVarStmt","stmt":{"source":{"type":"local","value":2},"target":3,"file":0,"col":0,"row":0}}
This seems a bit silly, since machine-generated IR (or our own future compiler passes!) may not have a meaningful line number to attach to an instruction.
Proposed Solution
I'd like those fields to be optional, and if we have to include them all the time, let's at least have them default to 0 or something during decoding, so that our JSON-formatted IR test cases can be smaller.
Description
Currently, you cannot deserialize JSON-formatted Rego IR instructions (such as what you'd see in a
plan.jsonfile), unless they include file location fields (filename index,row,col).Example:
❌ This fails:
{"type":"AssignVarStmt","stmt":{"source":{"type":"local","value":2},"target":3}}✅ This works:
{"type":"AssignVarStmt","stmt":{"source":{"type":"local","value":2},"target":3,"file":0,"col":0,"row":0}}This seems a bit silly, since machine-generated IR (or our own future compiler passes!) may not have a meaningful line number to attach to an instruction.
Proposed Solution
I'd like those fields to be optional, and if we have to include them all the time, let's at least have them default to
0or something during decoding, so that our JSON-formatted IR test cases can be smaller.