Files
midas/tests/cases/checker/07_variance.py.ref.json

1475 lines
27 KiB
JSON

{
"diagnostics": [
{
"type": "Error",
"location": {
"start": [
14,
0
],
"end": [
14,
25
]
},
"message": "Cannot assign object to variable 'unused' of type Unused[T]"
},
{
"type": "Error",
"location": {
"start": [
15,
0
],
"end": [
15,
31
]
},
"message": "Cannot assign object to variable 'covariant' of type Covariant[+T]"
},
{
"type": "Error",
"location": {
"start": [
16,
0
],
"end": [
16,
39
]
},
"message": "Cannot assign object to variable 'contravariant' of type Contravariant[-T]"
},
{
"type": "Error",
"location": {
"start": [
17,
0
],
"end": [
17,
31
]
},
"message": "Cannot assign object to variable 'invariant' of type Invariant[T]"
},
{
"type": "Error",
"location": {
"start": [
18,
0
],
"end": [
18,
21
]
},
"message": "Cannot assign object to variable 'coco' of type Coco[+T]"
},
{
"type": "Error",
"location": {
"start": [
19,
0
],
"end": [
19,
29
]
},
"message": "Cannot assign object to variable 'cocontra' of type Cocontra[-T]"
},
{
"type": "Error",
"location": {
"start": [
20,
0
],
"end": [
20,
29
]
},
"message": "Cannot assign object to variable 'contraco' of type Contraco[-T]"
},
{
"type": "Error",
"location": {
"start": [
21,
0
],
"end": [
21,
37
]
},
"message": "Cannot assign object to variable 'contracontra' of type Contracontra[+T]"
},
{
"type": "Error",
"location": {
"start": [
22,
0
],
"end": [
22,
17
]
},
"message": "Cannot assign object to variable 't1' of type T1[T]"
},
{
"type": "Error",
"location": {
"start": [
23,
0
],
"end": [
23,
17
]
},
"message": "Cannot assign object to variable 't2' of type T2[T]"
},
{
"type": "Error",
"location": {
"start": [
28,
4
],
"end": [
28,
13
]
},
"message": "Too many positional arguments"
},
{
"type": "Error",
"location": {
"start": [
39,
0
],
"end": [
39,
33
]
},
"message": "Cannot assign object to variable 'cov1' of type Covariant[float]"
},
{
"type": "Error",
"location": {
"start": [
40,
0
],
"end": [
40,
31
]
},
"message": "Cannot assign object to variable 'cov2' of type Covariant[int]"
},
{
"type": "Error",
"location": {
"start": [
42,
0
],
"end": [
42,
11
]
},
"message": "Cannot assign Covariant[float] to variable 'cov2' of type Covariant[int]"
},
{
"type": "Error",
"location": {
"start": [
44,
0
],
"end": [
44,
40
]
},
"message": "Cannot assign object to variable 'contra1' of type Contravariant[float]"
},
{
"type": "Error",
"location": {
"start": [
45,
0
],
"end": [
45,
38
]
},
"message": "Cannot assign object to variable 'contra2' of type Contravariant[int]"
},
{
"type": "Error",
"location": {
"start": [
46,
0
],
"end": [
46,
17
]
},
"message": "Cannot assign Contravariant[int] to variable 'contra1' of type Contravariant[float]"
},
{
"type": "Error",
"location": {
"start": [
49,
0
],
"end": [
49,
33
]
},
"message": "Cannot assign object to variable 'inv1' of type Invariant[float]"
},
{
"type": "Error",
"location": {
"start": [
50,
0
],
"end": [
50,
31
]
},
"message": "Cannot assign object to variable 'inv2' of type Invariant[int]"
},
{
"type": "Error",
"location": {
"start": [
51,
0
],
"end": [
51,
11
]
},
"message": "Cannot assign Invariant[int] to variable 'inv1' of type Invariant[float]"
},
{
"type": "Error",
"location": {
"start": [
52,
0
],
"end": [
52,
11
]
},
"message": "Cannot assign Invariant[float] to variable 'inv2' of type Invariant[int]"
}
],
"judgments": [
{
"location": {
"from": "L14:17",
"to": "L14:23"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L14:17",
"to": "L14:25"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L15:23",
"to": "L15:29"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L15:23",
"to": "L15:31"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L16:31",
"to": "L16:37"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L16:31",
"to": "L16:39"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L17:23",
"to": "L17:29"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L17:23",
"to": "L17:31"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L18:13",
"to": "L18:19"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L18:13",
"to": "L18:21"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L19:21",
"to": "L19:27"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L19:21",
"to": "L19:29"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L20:21",
"to": "L20:27"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L20:21",
"to": "L20:29"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L21:29",
"to": "L21:35"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L21:29",
"to": "L21:37"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L22:9",
"to": "L22:15"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L22:9",
"to": "L22:17"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L23:9",
"to": "L23:15"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L23:9",
"to": "L23:17"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L27:4",
"to": "L27:10"
},
"expr": {
"_type": "VariableExpr",
"name": "unused"
},
"type": {
"name": "Unused",
"params": [
{
"name": "T",
"bound": null,
"variance": "INVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L28:4",
"to": "L28:13"
},
"expr": {
"_type": "VariableExpr",
"name": "covariant"
},
"type": {
"name": "Covariant",
"params": [
{
"name": "T",
"bound": null,
"variance": "COVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L29:4",
"to": "L29:17"
},
"expr": {
"_type": "VariableExpr",
"name": "contravariant"
},
"type": {
"name": "Contravariant",
"params": [
{
"name": "T",
"bound": null,
"variance": "CONTRAVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L30:4",
"to": "L30:13"
},
"expr": {
"_type": "VariableExpr",
"name": "invariant"
},
"type": {
"name": "Invariant",
"params": [
{
"name": "T",
"bound": null,
"variance": "INVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L31:4",
"to": "L31:8"
},
"expr": {
"_type": "VariableExpr",
"name": "coco"
},
"type": {
"name": "Coco",
"params": [
{
"name": "T",
"bound": null,
"variance": "COVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L32:4",
"to": "L32:12"
},
"expr": {
"_type": "VariableExpr",
"name": "cocontra"
},
"type": {
"name": "Cocontra",
"params": [
{
"name": "T",
"bound": null,
"variance": "CONTRAVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L33:4",
"to": "L33:12"
},
"expr": {
"_type": "VariableExpr",
"name": "contraco"
},
"type": {
"name": "Contraco",
"params": [
{
"name": "T",
"bound": null,
"variance": "CONTRAVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L34:4",
"to": "L34:16"
},
"expr": {
"_type": "VariableExpr",
"name": "contracontra"
},
"type": {
"name": "Contracontra",
"params": [
{
"name": "T",
"bound": null,
"variance": "COVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L35:4",
"to": "L35:6"
},
"expr": {
"_type": "VariableExpr",
"name": "t1"
},
"type": {
"name": "T1",
"params": [
{
"name": "T",
"bound": null,
"variance": "INVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L36:4",
"to": "L36:6"
},
"expr": {
"_type": "VariableExpr",
"name": "t2"
},
"type": {
"name": "T2",
"params": [
{
"name": "T",
"bound": null,
"variance": "INVARIANT"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L26:0",
"to": "L26:5"
},
"expr": {
"_type": "VariableExpr",
"name": "print"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {}
}
},
{
"location": {
"from": "L26:0",
"to": "L37:1"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "print"
},
"arguments": [
{
"_type": "VariableExpr",
"name": "unused"
},
{
"_type": "VariableExpr",
"name": "covariant"
},
{
"_type": "VariableExpr",
"name": "contravariant"
},
{
"_type": "VariableExpr",
"name": "invariant"
},
{
"_type": "VariableExpr",
"name": "coco"
},
{
"_type": "VariableExpr",
"name": "cocontra"
},
{
"_type": "VariableExpr",
"name": "contraco"
},
{
"_type": "VariableExpr",
"name": "contracontra"
},
{
"_type": "VariableExpr",
"name": "t1"
},
{
"_type": "VariableExpr",
"name": "t2"
}
],
"keywords": {}
},
"type": {}
},
{
"location": {
"from": "L39:25",
"to": "L39:31"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L39:25",
"to": "L39:33"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L40:23",
"to": "L40:29"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L40:23",
"to": "L40:31"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L41:7",
"to": "L41:11"
},
"expr": {
"_type": "VariableExpr",
"name": "cov2"
},
"type": {
"name": "Covariant",
"args": [
{
"name": "int"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L42:7",
"to": "L42:11"
},
"expr": {
"_type": "VariableExpr",
"name": "cov1"
},
"type": {
"name": "Covariant",
"args": [
{
"name": "float"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L44:32",
"to": "L44:38"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L44:32",
"to": "L44:40"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L45:30",
"to": "L45:36"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L45:30",
"to": "L45:38"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L46:10",
"to": "L46:17"
},
"expr": {
"_type": "VariableExpr",
"name": "contra2"
},
"type": {
"name": "Contravariant",
"args": [
{
"name": "int"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L47:10",
"to": "L47:17"
},
"expr": {
"_type": "VariableExpr",
"name": "contra1"
},
"type": {
"name": "Contravariant",
"args": [
{
"name": "float"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L49:25",
"to": "L49:31"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L49:25",
"to": "L49:33"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L50:23",
"to": "L50:29"
},
"expr": {
"_type": "VariableExpr",
"name": "object"
},
"type": {
"params": {
"pos": [
{
"pos": 0,
"name": "object",
"type": {},
"required": false,
"unsupported": false
}
],
"mixed": [],
"kw": []
},
"returns": {
"name": "object"
}
}
},
{
"location": {
"from": "L50:23",
"to": "L50:31"
},
"expr": {
"_type": "CallExpr",
"callee": {
"_type": "VariableExpr",
"name": "object"
},
"arguments": [],
"keywords": {}
},
"type": {
"name": "object"
}
},
{
"location": {
"from": "L51:7",
"to": "L51:11"
},
"expr": {
"_type": "VariableExpr",
"name": "inv2"
},
"type": {
"name": "Invariant",
"args": [
{
"name": "int"
}
],
"body": {
"name": "object"
}
}
},
{
"location": {
"from": "L52:7",
"to": "L52:11"
},
"expr": {
"_type": "VariableExpr",
"name": "inv1"
},
"type": {
"name": "Invariant",
"args": [
{
"name": "float"
}
],
"body": {
"name": "object"
}
}
}
]
}