You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/pa2-tests/core/bad_list_index.py.ast.typed

275 lines
6.8 KiB

{
"kind" : "Program",
"location" : [ 1, 1, 7, 23 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 14 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 7 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ListType",
"location" : [ 1, 3, 1, 7 ],
"elementType" : {
"kind" : "ClassType",
"location" : [ 1, 4, 1, 6 ],
"className" : "int"
}
}
},
"value" : {
"kind" : "NoneLiteral",
"location" : [ 1, 11, 1, 14 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<None>"
}
}
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 3, 1, 3, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
} ],
"value" : {
"kind" : "ListExpr",
"location" : [ 3, 5, 3, 13 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"elements" : [ {
"kind" : "IntegerLiteral",
"location" : [ 3, 6, 3, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}, {
"kind" : "IntegerLiteral",
"location" : [ 3, 12, 3, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
} ]
}
}, {
"kind" : "ExprStmt",
"location" : [ 4, 1, 4, 7 ],
"expr" : {
"kind" : "IndexExpr",
"location" : [ 4, 1, 4, 7 ],
"errorMsg" : "Index is of non-integer type `bool`",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 4, 1, 4, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "BooleanLiteral",
"location" : [ 4, 3, 4, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : true
}
}
}, {
"kind" : "ExprStmt",
"location" : [ 5, 1, 5, 8 ],
"expr" : {
"kind" : "IndexExpr",
"location" : [ 5, 1, 5, 8 ],
"errorMsg" : "Cannot index into type `bool`",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"list" : {
"kind" : "BooleanLiteral",
"location" : [ 5, 1, 5, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : false
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 5, 7, 5, 7 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
}
}, {
"kind" : "ExprStmt",
"location" : [ 6, 1, 6, 5 ],
"expr" : {
"kind" : "IndexExpr",
"location" : [ 6, 1, 6, 5 ],
"errorMsg" : "Cannot index into type `<Empty>`",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"list" : {
"kind" : "ListExpr",
"location" : [ 6, 1, 6, 2 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "<Empty>"
},
"elements" : [ ]
},
"index" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 4, 6, 4 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
}
}, {
"kind" : "AssignStmt",
"location" : [ 7, 1, 7, 22 ],
"targets" : [ {
"kind" : "IndexExpr",
"location" : [ 7, 1, 7, 7 ],
"errorMsg" : "Index is of non-integer type `bool`",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 1 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "BooleanLiteral",
"location" : [ 7, 3, 7, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : true
}
}, {
"kind" : "IndexExpr",
"location" : [ 7, 11, 7, 18 ],
"errorMsg" : "Index is of non-integer type `bool`",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"list" : {
"kind" : "Identifier",
"location" : [ 7, 11, 7, 11 ],
"inferredType" : {
"kind" : "ListValueType",
"elementType" : {
"kind" : "ClassValueType",
"className" : "int"
}
},
"name" : "x"
},
"index" : {
"kind" : "BooleanLiteral",
"location" : [ 7, 13, 7, 17 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "bool"
},
"value" : false
}
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 7, 22, 7, 22 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ],
"errors" : {
"errors" : [ {
"kind" : "CompilerError",
"location" : [ 4, 1, 4, 7 ],
"message" : "Index is of non-integer type `bool`"
}, {
"kind" : "CompilerError",
"location" : [ 5, 1, 5, 8 ],
"message" : "Cannot index into type `bool`"
}, {
"kind" : "CompilerError",
"location" : [ 6, 1, 6, 5 ],
"message" : "Cannot index into type `<Empty>`"
}, {
"kind" : "CompilerError",
"location" : [ 7, 1, 7, 7 ],
"message" : "Index is of non-integer type `bool`"
}, {
"kind" : "CompilerError",
"location" : [ 7, 11, 7, 18 ],
"message" : "Index is of non-integer type `bool`"
} ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}