File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
tests/python/tir-analysis Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -345,5 +345,32 @@ 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+ with T .LetStmt (99 , var = x ): # This should trigger the error
364+ T .evaluate (x )
365+
366+ with pytest .raises (ValueError ) as exc_info :
367+ tvm .tir .analysis .verify_well_formed (func_variable_not_in_previous_map , assert_mode = True )
368+
369+ error_msg = str (exc_info .value )
370+
371+ assert "TIR is ill-formed" in error_msg
372+ assert "multiple definitions of variable" in error_msg
373+
374+
348375if __name__ == "__main__" :
349376 tvm .testing .main ()
You can’t perform that action at this time.
0 commit comments