@@ -41,7 +41,7 @@ class SemanticListener(MyParserListener):
41
41
42
42
def __init__ (self ):
43
43
self .nested_loop_counter = 0
44
- self .variables : dict [str , Type | None ] = {}
44
+ self .variables : dict [str , Type | tuple | None ] = {}
45
45
self .expr_type : dict [
46
46
ParserRuleContext , Type | tuple | None
47
47
] = {} # values should be either Type or (Type, int | None, int | None, ...)
@@ -224,7 +224,7 @@ def exitVector(self, ctx: MyParser.VectorContext):
224
224
)
225
225
226
226
def exitElementReference (self , ctx : MyParser .ElementReferenceContext ):
227
- references = ctx .children [2 ::2 ]
227
+ references : list [ ParserRuleContext ] = ctx .children [2 ::2 ]
228
228
for ref in references :
229
229
if self .expr_type [ref ] != Type .INT :
230
230
ctx .parser .notifyErrorListeners (
@@ -254,7 +254,7 @@ def exitElementReference(self, ctx: MyParser.ElementReferenceContext):
254
254
if is_plain_integer (ref ) and id_type [i + 1 ] is not None :
255
255
if int (ref .getText ()) >= id_type [i + 1 ]:
256
256
ctx .parser .notifyErrorListeners (
257
- "Index out of bounds" , ctx .getChild (1 ).getSymbol ()
257
+ "Index out of bounds" , ref .getChild (0 ). getChild ( 0 ).getSymbol ()
258
258
)
259
259
260
260
def exitId (self , ctx : MyParser .IdContext ):
0 commit comments