Skip to content
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

Update lark grammar to handle imported types in array/tuple/map def #4213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

benber86
Copy link
Contributor

What I did

Current lark grammar can't parse types imported from modules in array/dynarray/tuples/hashmap definitions.
For instance:

sample_list: multiclaim.Controller[multiclaim.MAX_CONTROLLERS]
def dispatch_fees(controllers: DynArray[multiclaim.Controller, multiclaim.MAX_CONTROLLERS]=[]) -> (uint256, multiclaim.Controller):
exampleMapping: HashMap[multiclaim.Controller, multiclaim.Controller]

How I did it

Added imported_type to the array/dynarray/tuple/map def in grammar

How to verify it

Commit message

Update lark grammar to handle imported types in array/tuples definition

Description for the changelog

Cute Animal Picture

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

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.92%. Comparing base (f909d6e) to head (44b4223).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4213      +/-   ##
==========================================
- Coverage   91.35%   88.92%   -2.44%     
==========================================
  Files         109      109              
  Lines       15635    15635              
  Branches     3443     3443              
==========================================
- Hits        14283    13903     -380     
- Misses        920     1223     +303     
- Partials      432      509      +77     

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

// NOTE: Map takes a basic type and maps to another type (can be non-basic, including maps)
_MAP: "HashMap"
map_def: _MAP "[" ( NAME | array_def ) "," type "]"
map_def: _MAP "[" ( NAME | imported_type | array_def ) "," type "]"
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this correct as mappings, arrays or structs are not supported as key types?

@cyberthirst
Copy link
Collaborator

Can we please add a test for the imported types?

@charles-cooper charles-cooper added this to the v0.4.1 milestone Sep 1, 2024
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.

3 participants