-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
Fix type checking of tuple types in return statements #1057
Conversation
There's currently an issue with this "fix" that causes a number of tests to fail (https://dpaste.de/Y6hV#L566). These modifications cause |
I really think a more expressive, class-based type system would help here. That's a larger fix, but this is starting to look hacky |
By the way, it seems a bit odd that the two "empty" internal unit values,
What's the asterisk supposed to represent? |
@fubuloubu I agree actually. I don't really consider this change to be a proper fix. I'm mostly using this PR to try and understand the mechanics of the issue and to act as a comments thread. |
I started trying to prototype something in blocktract, but I got hung up on figuring out the types of statements and stuff. I think taking a more functional approach, with type classes (which may host units) and other objects representing operators, statements, functions, and contracts themselves would allow a more holistic approach with our own custom AST (that converts to LLL), avoiding issues like this in the long term (and make Vyper easier to work with!) |
@fubuloubu Any thoughts about the asterisk thing in the comment above? |
Thoughts? It just looks wrong to me lol |
@davesque The |
@jacqueswww I noticed there's a "positional" property on Also, why would a value being a literal be related to its type information? Shouldn't it still be compatible with any other value of the same type whether the value is determined at run-time or compile-time? |
So basically it's not the job of the ast to know this information at this stage, one needs this information to be able to operate on it later on the traversal. A literal, in memory or storage variable have different ways of being accessed if used in larger expressions so that's why everywhere you see the '.typ.typ == .typ.typ' in the code where base (string) gets compared. |
@davesque wait a minute checking the '*' on repr, isn't it just the unit type? |
Fixed in #1175, with new TupleLike type. |
- What I did
Fixed #1006 .
- How I did it
Updated code in
Stmt.parse_return
.- How to verify it
Run the tests.
- Description for the changelog
An issue with type checking of tuple types in return statements, which caused type checking to erroneously pass in certain cases, was fixed.
- Cute Animal Picture