File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
tests/python/tir-analysis Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -345,5 +345,35 @@ def func():
345345 tvm .tir .analysis .verify_well_formed (mod )
346346
347347
348+ def test_error_message_without_previous_definition_location ():
349+ """Test case 1: Error message without 'It was first defined at'
350+
351+ This tests the scenario where it == end(), so the error message should contain
352+ 'TIR is ill-formed, due to multiple definitions of variable' but should NOT
353+ contain 'It was first defined at' since the iterator is invalid.
354+ """
355+
356+ @I .ir_module (check_well_formed = False )
357+ def func_variable_not_in_previous_map ():
358+ x = T .int32 ()
359+
360+ with T .LetStmt (42 , var = x ):
361+ T .evaluate (x )
362+
363+
364+ with T .LetStmt (99 , var = x ): # This should trigger the error
365+ T .evaluate (x )
366+
367+
368+ with pytest .raises (ValueError ) as exc_info :
369+ tvm .tir .analysis .verify_well_formed (func_variable_not_in_previous_map , assert_mode = True )
370+
371+
372+ error_msg = str (exc_info .value )
373+
374+ assert "TIR is ill-formed" in error_msg
375+ assert "multiple definitions of variable" in error_msg
376+
377+
348378if __name__ == "__main__" :
349379 tvm .testing .main ()
You can’t perform that action at this time.
0 commit comments