@@ -41,7 +41,7 @@ class SemanticListener(MyParserListener):
4141
4242 def __init__ (self ):
4343 self .nested_loop_counter = 0
44- self .variables : dict [str , Type | None ] = {}
44+ self .variables : dict [str , Type | tuple | None ] = {}
4545 self .expr_type : dict [
4646 ParserRuleContext , Type | tuple | None
4747 ] = {} # values should be either Type or (Type, int | None, int | None, ...)
@@ -224,7 +224,7 @@ def exitVector(self, ctx: MyParser.VectorContext):
224224 )
225225
226226 def exitElementReference (self , ctx : MyParser .ElementReferenceContext ):
227- references = ctx .children [2 ::2 ]
227+ references : list [ ParserRuleContext ] = ctx .children [2 ::2 ]
228228 for ref in references :
229229 if self .expr_type [ref ] != Type .INT :
230230 ctx .parser .notifyErrorListeners (
@@ -254,7 +254,7 @@ def exitElementReference(self, ctx: MyParser.ElementReferenceContext):
254254 if is_plain_integer (ref ) and id_type [i + 1 ] is not None :
255255 if int (ref .getText ()) >= id_type [i + 1 ]:
256256 ctx .parser .notifyErrorListeners (
257- "Index out of bounds" , ctx .getChild (1 ).getSymbol ()
257+ "Index out of bounds" , ref .getChild (0 ). getChild ( 0 ).getSymbol ()
258258 )
259259
260260 def exitId (self , ctx : MyParser .IdContext ):
0 commit comments