Skip to content

fix[lang]: use folded node for typechecking#4365

Merged
charles-cooper merged 12 commits intovyperlang:masterfrom
tserg:fix/slice_folded
Nov 23, 2024
Merged

fix[lang]: use folded node for typechecking#4365
charles-cooper merged 12 commits intovyperlang:masterfrom
tserg:fix/slice_folded

Conversation

@tserg
Copy link
Copy Markdown
Contributor

@tserg tserg commented Nov 20, 2024

What I did

Fix #4190, #4360.

How I did it

Use the reduced node for typechecking.

How to verify it

See added tests

Commit message

This commit addresses several issues in the frontend where valid code
fails to compile because typechecking was performed on non-literal
AST nodes, specifically in `slice()` and `raw_log()` builtins. This is
fixed by using the folded node for typechecking instead.

Additionally, folding is applied for the argument to `convert()`, which
results in the typechecker being able to reject more invalid programs.

Description for the changelog

Fix compilation for valid syntax with foldable values

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.81%. Comparing base (f38b61a) to head (7f86961).
Report is 59 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4365      +/-   ##
==========================================
- Coverage   90.99%   88.81%   -2.18%     
==========================================
  Files         112      112              
  Lines       16017    16018       +1     
  Branches     2696     2696              
==========================================
- Hits        14574    14226     -348     
- Misses       1005     1281     +276     
- Partials      438      511      +73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tserg tserg changed the title fix(lang): use folded node for typechecking fix[lang]: use folded node for typechecking Nov 20, 2024
@tserg tserg marked this pull request as ready for review November 20, 2024 06:57
@tserg tserg requested a review from charles-cooper November 20, 2024 06:57
@charles-cooper charles-cooper removed their request for review November 20, 2024 09:37
@tserg tserg requested a review from charles-cooper November 20, 2024 14:45
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add another test for conversion of invalid bytestrings

@tserg tserg requested a review from charles-cooper November 21, 2024 03:56
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. @cyberthirst is there anything you want to see here?

@charles-cooper charles-cooper enabled auto-merge (squash) November 23, 2024 20:26
@charles-cooper charles-cooper merged commit bd876b1 into vyperlang:master Nov 23, 2024
@tserg tserg deleted the fix/slice_folded branch November 24, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folding Not Supported in Certain Locations

3 participants