mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
assert with more information to help debug (#132194)
This PR output debug message to assertion to help debug user python
code. Will print out more friendly information
```
> assert isinstance(arg, _cext.ir.Value), f"expects Value, got {type(arg)}"
E AssertionError: expected Value, got <class 'UserDefinedClass'>
```
This commit is contained in:
@@ -105,7 +105,7 @@ def get_op_result_or_value(
|
||||
elif isinstance(arg, _cext.ir.OpResultList):
|
||||
return arg[0]
|
||||
else:
|
||||
assert isinstance(arg, _cext.ir.Value)
|
||||
assert isinstance(arg, _cext.ir.Value), f"expects Value, got {type(arg)}"
|
||||
return arg
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ def get_op_result_or_op_results(
|
||||
else:
|
||||
return op
|
||||
|
||||
|
||||
ResultValueTypeTuple = _cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value
|
||||
ResultValueT = _Union[ResultValueTypeTuple]
|
||||
VariadicResultValueT = _Union[ResultValueT, _Sequence[ResultValueT]]
|
||||
|
||||
Reference in New Issue
Block a user