leo/compiler/tests/canonicalization/compound_assignment.json

811 lines
27 KiB
JSON
Raw Normal View History

{
2021-03-27 00:14:37 +03:00
"name": "",
"expected_input": [],
"imports": [],
"circuits": {
"{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\"}\"}": {
"circuit_name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\"}\"}",
"members": [
{
"CircuitVariable": [
"{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}",
{
2021-03-27 00:14:37 +03:00
"IntegerType": "U8"
}
]
}
]
}
},
"functions": {
"{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\"}\"}": {
"annotations": [],
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\"}\"}",
"input": [],
"output": {
"Tuple": []
},
"block": {
"statements": [
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 5,
"line_stop": 5,
"col_start": 9,
"col_stop": 10,
"path": ""
}
}
],
"type_": null,
"value": {
"Value": {
"Integer": [
"U32",
"10",
{
"line_start": 5,
"line_stop": 5,
"col_start": 13,
"col_stop": 18,
"path": ""
}
]
}
},
"span": {
"line_start": 5,
"line_stop": 5,
"col_start": 5,
"col_stop": 18,
"path": ""
}
}
},
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}",
"accesses": [],
"span": {
"line_start": 6,
"line_stop": 6,
"col_start": 5,
"col_stop": 6,
"path": ""
}
},
"value": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}"
},
"right": {
"Value": {
"Implicit": [
"20",
{
"line_start": 6,
"line_stop": 6,
"col_start": 10,
"col_stop": 12,
"path": ""
}
]
}
},
"op": "Add",
"span": {
"line_start": 6,
"line_stop": 6,
"col_start": 5,
"col_stop": 12,
"path": ""
}
}
},
"span": {
"line_start": 6,
"line_stop": 6,
"col_start": 5,
"col_stop": 12,
"path": ""
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
"Identifier": "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\"}\"}"
},
"right": {
"Value": {
"Integer": [
"U32",
"30",
{
"line_start": 7,
"line_stop": 7,
"col_start": 25,
"col_stop": 30,
"path": ""
}
]
}
},
"op": "Eq",
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 7,
"line_stop": 7,
"col_start": 20,
"col_stop": 30,
"path": ""
}
}
2021-03-27 00:14:37 +03:00
}
},
"span": {
"line_start": 7,
"line_stop": 7,
"col_start": 5,
"col_stop": 30,
"path": ""
}
}
},
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 9,
"line_stop": 9,
"col_start": 9,
"col_stop": 10,
"path": ""
}
}
],
"type_": null,
"value": {
"ArrayInline": {
"elements": [
{
"Expression": {
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 9,
"line_stop": 9,
"col_start": 14,
"col_stop": 17,
"path": ""
}
]
}
}
},
{
"Expression": {
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 9,
"line_stop": 9,
"col_start": 19,
"col_stop": 22,
"path": ""
}
]
}
}
}
],
"span": {
"line_start": 9,
"line_stop": 9,
"col_start": 13,
"col_stop": 23,
"path": ""
}
}
},
"span": {
"line_start": 9,
"line_stop": 9,
"col_start": 5,
"col_stop": 23,
"path": ""
}
}
},
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}",
"accesses": [
{
"ArrayIndex": {
"Value": {
"Implicit": [
"0",
{
"line_start": 10,
"line_stop": 10,
"col_start": 7,
"col_stop": 8,
"path": ""
}
]
}
}
}
],
2021-03-27 00:14:37 +03:00
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 5,
"col_stop": 9,
"path": ""
}
},
"value": {
"Binary": {
"left": {
"ArrayAccess": {
"array": {
"Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}"
},
"index": {
"Value": {
"Implicit": [
"0",
{
"line_start": 10,
"line_stop": 10,
"col_start": 7,
"col_stop": 8,
"path": ""
}
]
}
},
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 5,
"col_stop": 16,
"path": ""
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"3",
{
"line_start": 10,
"line_stop": 10,
"col_start": 13,
"col_stop": 16,
"path": ""
}
]
}
},
"op": "Add",
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 5,
"col_stop": 16,
"path": ""
}
}
},
"span": {
"line_start": 10,
"line_stop": 10,
"col_start": 5,
"col_stop": 16,
"path": ""
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
"ArrayAccess": {
"array": {
"Identifier": "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\"}\"}"
},
"index": {
"Value": {
"Implicit": [
"0",
{
"line_start": 11,
"line_stop": 11,
"col_start": 22,
"col_stop": 23,
"path": ""
}
]
}
},
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 20,
"col_stop": 24,
"path": ""
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"4",
{
"line_start": 11,
"line_stop": 11,
"col_start": 28,
"col_stop": 31,
"path": ""
}
]
}
},
"op": "Eq",
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 20,
"col_stop": 31,
"path": ""
}
}
}
},
"span": {
"line_start": 11,
"line_stop": 11,
"col_start": 5,
"col_stop": 31,
"path": ""
}
}
},
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 9,
"col_stop": 10,
"path": ""
}
}
],
"type_": null,
"value": {
"TupleInit": {
"elements": [
{
"Value": {
"Integer": [
"U8",
"1",
{
"line_start": 13,
"line_stop": 13,
"col_start": 14,
"col_stop": 17,
"path": ""
}
]
}
},
{
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 13,
"line_stop": 13,
"col_start": 19,
"col_stop": 22,
"path": ""
}
]
}
}
],
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 13,
"col_stop": 23,
"path": ""
}
}
},
"span": {
"line_start": 13,
"line_stop": 13,
"col_start": 5,
"col_stop": 23,
"path": ""
}
}
},
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}",
"accesses": [
{
"Tuple": [
{
"value": "1"
},
{
2021-03-27 00:14:37 +03:00
"line_start": 14,
"line_stop": 14,
"col_start": 5,
"col_stop": 8,
"path": ""
}
]
}
2021-03-27 00:14:37 +03:00
],
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 14,
"line_stop": 14,
"col_start": 5,
"col_stop": 8,
"path": ""
}
2021-03-27 00:14:37 +03:00
},
"value": {
"Binary": {
"left": {
"TupleAccess": {
"tuple": {
"Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\"}\"}"
},
"index": {
"value": "1"
},
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 5,
"col_stop": 15,
"path": ""
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"3",
{
"line_start": 14,
"line_stop": 14,
"col_start": 12,
"col_stop": 15,
"path": ""
}
]
}
},
"op": "Add",
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 14,
"line_stop": 14,
"col_start": 5,
"col_stop": 15,
"path": ""
}
2021-03-27 00:14:37 +03:00
}
},
"span": {
"line_start": 14,
"line_stop": 14,
"col_start": 5,
"col_stop": 15,
"path": ""
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
2021-03-27 00:14:37 +03:00
"TupleAccess": {
"tuple": {
"Identifier": "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\"}\"}"
},
"index": {
"value": "1"
},
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 20,
"col_stop": 23,
"path": ""
}
}
},
"right": {
"Value": {
2021-03-27 00:14:37 +03:00
"Integer": [
"U8",
"5",
{
2021-03-27 00:14:37 +03:00
"line_start": 15,
"line_stop": 15,
"col_start": 27,
"col_stop": 30,
"path": ""
}
]
}
},
2021-03-27 00:14:37 +03:00
"op": "Eq",
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 15,
"line_stop": 15,
"col_start": 20,
"col_stop": 30,
"path": ""
}
}
2021-03-27 00:14:37 +03:00
}
},
"span": {
"line_start": 15,
"line_stop": 15,
"col_start": 5,
"col_stop": 30,
"path": ""
}
}
},
{
"Definition": {
"declaration_type": "Let",
"variable_names": [
{
"mutable": true,
"identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 17,
"line_stop": 17,
"col_start": 9,
"col_stop": 12,
"path": ""
}
}
],
"type_": null,
"value": {
"CircuitInit": {
"name": "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":15,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\"}\"}",
"members": [
{
"identifier": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\"}\"}",
"expression": {
"Value": {
"Integer": [
"U8",
"6",
{
"line_start": 17,
"line_stop": 17,
"col_start": 24,
"col_stop": 27,
"path": ""
}
]
}
}
}
],
"span": {
"line_start": 17,
"line_stop": 17,
"col_start": 15,
"col_stop": 29,
"path": ""
}
}
},
"span": {
"line_start": 17,
"line_stop": 17,
"col_start": 5,
"col_stop": 29,
"path": ""
}
}
},
{
"Assign": {
"operation": "Assign",
"assignee": {
"identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\"}\"}",
"accesses": [
{
"Member": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\"}\"}"
}
],
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 18,
"line_stop": 18,
"col_start": 5,
"col_stop": 10,
"path": ""
}
2021-03-27 00:14:37 +03:00
},
"value": {
"Binary": {
"left": {
"CircuitMemberAccess": {
"circuit": {
"Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\"}\"}"
},
"name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 13,
"col_stop": 18,
"path": ""
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"2",
{
"line_start": 18,
"line_stop": 18,
"col_start": 21,
"col_stop": 24,
"path": ""
}
]
}
},
"op": "Add",
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 13,
"col_stop": 24,
"path": ""
}
}
},
"span": {
"line_start": 18,
"line_stop": 18,
"col_start": 5,
"col_stop": 24,
"path": ""
}
}
},
{
"Console": {
"function": {
"Assert": {
"Binary": {
"left": {
"CircuitMemberAccess": {
"circuit": {
"Identifier": "{\"name\":\"foo\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":20,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\"}\"}"
},
"name": "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\"}\"}",
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 20,
"col_stop": 25,
"path": ""
}
}
},
"right": {
"Value": {
"Integer": [
"U8",
"8",
{
"line_start": 19,
"line_stop": 19,
"col_start": 29,
"col_stop": 32,
"path": ""
}
]
}
},
"op": "Eq",
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 20,
"col_stop": 32,
"path": ""
}
}
}
},
"span": {
"line_start": 19,
"line_stop": 19,
"col_start": 5,
"col_stop": 32,
"path": ""
}
}
}
2021-03-27 00:14:37 +03:00
],
"span": {
2021-03-27 00:14:37 +03:00
"line_start": 4,
"line_stop": 20,
"col_start": 17,
"col_stop": 2,
"path": ""
}
2021-03-27 00:14:37 +03:00
},
"span": {
"line_start": 4,
"line_stop": 20,
"col_start": 1,
"col_stop": 2,
"path": ""
}
}
}
2021-03-27 00:14:37 +03:00
}