Syntax errors on Seq arrays do not clearly indicate where the syntax error is when the return type of a non-final expression is not TealType.none and will only point to the parent Seq statement. This change will reference the offending statement in the error message.
...
File "/home/user/my_contract.py", line 210, in generate_approval_program_v1
Seq([
File "/home/user/ENV3/lib/python3.10/site-packages/pyteal/ast/seq.py", line 60, in __init__
raise e
File "/home/user/ENV3/lib/python3.10/site-packages/pyteal/ast/seq.py", line 55, in __init__
require_type(expr, TealType.none)
File "/home/user/ENV3/lib/python3.10/site-packages/pyteal/types.py", line 38, in require_type
raise TealTypeError(actual, expected)
pyteal.TealSeqError: (box_create (Itob (Txna Assets 0)) (Int 16)) must have a return type of TealType.none. Only the last entry of a Seq array can have a return value.
Syntax errors on
Seq
arrays do not clearly indicate where the syntax error is when the return type of a non-final expression is notTealType.none
and will only point to the parentSeq
statement. This change will reference the offending statement in the error message.This code:
Will now produce this error: