-
-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed the Incorrect error messages during compilation #3994. #4340
base: master
Are you sure you want to change the base?
Conversation
@@ -1440,7 +1440,7 @@ def validate(self): | |||
|
|||
if not self.is_constant and self.value is not None: | |||
raise VariableDeclarationException( | |||
f"{self._pretty_location} variables cannot have an initial value", self.value | |||
f"{self._pretty_location()} variables cannot have an initial value", self.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not correct, _pretty_location
is a property. try to compile eg c: uint256 = 1
@@ -1663,7 +1663,7 @@ class _CreateBase(BuiltinFunctionT): | |||
@process_inputs | |||
def build_IR(self, expr, args, kwargs, context): | |||
# errmsg something like f"Cannot use {self._id} in pure fn" | |||
context.check_is_not_constant(f"use {self._id}", expr) | |||
context.check_is_not_constant(f"Error: {self._id} is not a constant") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not correct, check_is_not_constant
takes 3 args, only 2 provided
see eg:
@pure
def foo(a: address):
b: address = create_minimal_proxy_to(a)
Hello, even if the fixes were made, I'm not sure this PR is relevant. When #3994 was created, and |
Hi there.
Are there other relevant and present issues I can attend to? How can I
identify old issues that have already been fixed? Good day.
…On Tue, Nov 5, 2024, 09:48 cyberthirst ***@***.***> wrote:
Hello, even if the fixes were made, I'm not sure this PR is relevant.
When #3994 <#3994> was created,
pretty_location was a function
and _CreateBase.build_IR didn't use f-string which is no longer the case
—
Reply to this email directly, view it on GitHub
<#4340 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BD64XCF2WIFYI5W5DESID2LZ7CA5HAVCNFSM6AAAAABQ5BWAXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJWGU3TCOBVGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
…build_IR
What I did
I updated issue in VariableDecl.validate() and update string formatting in build_IR codes.
How I did it
I cloned the repo and fixed that part of the code.
How to verify it
run pytest
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Improved: Updated VariableDecl.validate() to correctly use self._pretty_location() for consistent variable location formatting.
Fixed: Modified _CreateBase.build_IR to use an f-string in context.check_is_not_constant, ensuring self._id is properly displayed in error messages.
Cute Animal Picture
It's a cute piglet.