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

Parsing and generation of dictionaries #438

Merged
merged 8 commits into from
Jan 21, 2023
Merged

Parsing and generation of dictionaries #438

merged 8 commits into from
Jan 21, 2023

Conversation

JSAbrahams
Copy link
Owner

@JSAbrahams JSAbrahams commented Jan 8, 2023

Relevant issues

Summary

  • Add parsing of dictionaries
  • Add dictionary type skeleton to context:
    • iterator returning types
    • keys() method which returns iterator where __next__() has key return type
    • values() method which returns iterator where __next__() has value return type
  • Check of dictionaries

Added Tests

Happy

  • Parse dictionary.
  • Parse dictionary builder.
  • Dictionary with multiple types.

Sad

  • Dictionary with types other than signature.
  • Access dictionary entries with wrong key type.
  • Access dictionary and have use value incorrectly (assume it is other type).
  • Access dictionary and have use value incorrectly (assume it is key type).
  • Index dictionary using slice
  • index set

@JSAbrahams JSAbrahams added enhancement: check New feature in the type check module enhancement: parse New feature in the parse module labels Jan 8, 2023
@JSAbrahams JSAbrahams added this to the v0.3.6 | Dictionaries milestone Jan 8, 2023
@JSAbrahams JSAbrahams self-assigned this Jan 8, 2023
@codecov
Copy link

codecov bot commented Jan 8, 2023

Codecov Report

Merging #438 (0a2937e) into develop (f1b0646) will increase coverage by 0.01%.
The diff coverage is 87.50%.

@@             Coverage Diff             @@
##           develop     #438      +/-   ##
===========================================
+ Coverage    88.16%   88.17%   +0.01%     
===========================================
  Files          105      105              
  Lines        11391    11497     +106     
===========================================
+ Hits         10043    10138      +95     
- Misses        1348     1359      +11     
Impacted Files Coverage Δ
src/check/constrain/constraint/mod.rs 91.89% <ø> (-2.45%) ⬇️
src/check/constrain/unify/function.rs 77.55% <0.00%> (ø)
src/check/context/function/python.rs 96.87% <ø> (ø)
src/generate/ast/node.rs 75.37% <0.00%> (-0.39%) ⬇️
src/parse/ast/node.rs 81.16% <0.00%> (-0.40%) ⬇️
src/check/context/function/mod.rs 52.00% <25.00%> (ø)
src/check/ast/mod.rs 67.28% <50.00%> (-0.33%) ⬇️
src/generate/ast/mod.rs 93.91% <69.23%> (-1.29%) ⬇️
src/check/context/clss/mod.rs 85.53% <75.00%> (-1.81%) ⬇️
src/generate/convert/builder.rs 76.92% <81.81%> (+1.92%) ⬆️
... and 20 more

@JSAbrahams JSAbrahams changed the title Add parsing and generation of dictionaries Parsing and generation of dictionaries Jan 9, 2023
Up next: sad tests to verify check implementation.
We also added a test for a slightly more complex
generation of dictionary calls.
We want to change the behaviour in Mamba such that
access of a dictionary gives an `Optional`, with
no chance of a `KeyError` being thrown.
@JSAbrahams JSAbrahams added the enhancement: generate New feature in the core module label Jan 17, 2023
@JSAbrahams JSAbrahams linked an issue Jan 19, 2023 that may be closed by this pull request
2 tasks
@JSAbrahams JSAbrahams marked this pull request as ready for review January 21, 2023 11:43
@JSAbrahams JSAbrahams merged commit 0bb4c67 into develop Jan 21, 2023
@JSAbrahams JSAbrahams deleted the dictionaries branch January 21, 2023 13:19
@JSAbrahams JSAbrahams mentioned this pull request Jan 21, 2023
JSAbrahams added a commit that referenced this pull request Jan 21, 2023
* Add parsing and generation of dictionaries

* Implement dictionary builder

* Use __getitem__ for index instead of iterator

* Add dictionary keys() and values() iters

* Verify set not indexable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement: check New feature in the type check module enhancement: generate New feature in the core module enhancement: parse New feature in the parse module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dictionaries
1 participant