You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python Version (output of python --version): 3.10.5
What's your issue about?
Whereas most other compile-time issues show the offending source line from the contract, compiling a dynamic array with an invalid size only shows an error with the source file name. Showing the line would help in searching and correcting typos or other issues causing the bad length value.
> vyper ~/Desktop/example.vy
Error compiling: /Users/ibis/Desktop/example.vy
vyper.exceptions.InvalidType: Array length is invalid
[9171] Failed to execute script 'vyper_compile' due to unhandled exception!
How can it be fixed?
Ideally when this issue occurs the compiler should print out the offending line like it does with other errors. For example if I were to deliberately cause an error in __init__() it displays the offending source:
A similar issue seems to occur for immutables referenced with self:
# @version 0.3.7# test.vyDATA: immutable(uint256)
@externaldef__init__(_data: uint256):
self.DATA=_data# this line should be shown in the error output
> vyper test.vy
Error compiling: test.vy
vyper.exceptions.SyntaxException: Immutable variables must be accessed without 'self'
[41858] Failed to execute script 'vyper_compile' due to unhandled exception!
hi @helloibis! I created a PR to address the first example you posted.
Regarding the second example with self.DATA = _data: when I run it now I do get a pointer to the line in the src code. Please let me know if you also do!
As it stands, the pointer is to line 1 as opposed to line 5, but at least there is one. I played around with adjusting it to line 5, but it appears to be a bit complicated. Do you think it's important?
Version Information
vyper --version
): 0.3.7python --version
): 3.10.5What's your issue about?
Whereas most other compile-time issues show the offending source line from the contract, compiling a dynamic array with an invalid size only shows an error with the source file name. Showing the line would help in searching and correcting typos or other issues causing the bad length value.
Super short example:
CLI output:
How can it be fixed?
Ideally when this issue occurs the compiler should print out the offending line like it does with other errors. For example if I were to deliberately cause an error in
__init__()
it displays the offending source:The text was updated successfully, but these errors were encountered: