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

Introduce HashableStruct type to represent Dictionary keys #2872

Merged
merged 15 commits into from
Oct 27, 2023

Conversation

darkdrag00nv2
Copy link
Contributor

@darkdrag00nv2 darkdrag00nv2 commented Oct 15, 2023

Closes #2428

Description

Introduce HashableStruct type to Cadence.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Copy link
Contributor Author

@darkdrag00nv2 darkdrag00nv2 left a comment

Choose a reason for hiding this comment

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

Opened it in WIP state to get some early feedback. Haven't yet dealt with the export/import and fixing the tests.

runtime/tests/checker/type_inference_test.go Show resolved Hide resolved
runtime/sema/type.go Show resolved Hide resolved
runtime/sema/path_type.go Show resolved Hide resolved
@darkdrag00nv2 darkdrag00nv2 marked this pull request as draft October 15, 2023 10:13
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (735a071) 79.38% compared to head (8a16ed2) 79.43%.
Report is 46 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2872      +/-   ##
==========================================
+ Coverage   79.38%   79.43%   +0.05%     
==========================================
  Files         334      332       -2     
  Lines       78826    79111     +285     
==========================================
+ Hits        62576    62842     +266     
- Misses      13944    13958      +14     
- Partials     2306     2311       +5     
Flag Coverage Δ
unittests 79.43% <89.83%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
encoding/ccf/decode_type.go 76.82% <100.00%> (+0.14%) ⬆️
encoding/ccf/simple_type_utils.go 100.00% <100.00%> (ø)
encoding/json/decode.go 88.61% <100.00%> (+0.02%) ⬆️
encoding/json/encode.go 95.03% <ø> (ø)
runtime/convertTypes.go 87.70% <100.00%> (+0.09%) ⬆️
runtime/convertValues.go 82.80% <ø> (-0.62%) ⬇️
runtime/interpreter/primitivestatictype.go 96.75% <100.00%> (+0.04%) ⬆️
runtime/interpreter/primitivestatictype_string.go 100.00% <ø> (ø)
runtime/sema/check_dictionary_expression.go 100.00% <100.00%> (ø)
runtime/sema/checker.go 92.62% <100.00%> (-0.01%) ⬇️
... and 5 more

... and 19 files with indirect coverage changes

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

@darkdrag00nv2 darkdrag00nv2 changed the title WIP: Introduce HashableStruct type to Cadence Introduce HashableStruct type to represent Dictionary keys Oct 19, 2023
@darkdrag00nv2 darkdrag00nv2 marked this pull request as ready for review October 19, 2023 16:58
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

Can you please also add some tests for using the HashableStructType in Cadence code?
i.e: Similar to runtime/tests/checker/any_test.go

runtime/sema/type_test.go Outdated Show resolved Hide resolved
runtime/sema/hashablestruct_type.go Outdated Show resolved Hide resolved
runtime/sema/type.go Outdated Show resolved Hide resolved
runtime/convertValues_test.go Outdated Show resolved Hide resolved
runtime/convertValues_test.go Outdated Show resolved Hide resolved
runtime/convertValues_test.go Outdated Show resolved Hide resolved
encoding/ccf/ccf_test.go Outdated Show resolved Hide resolved
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

Nice!

runtime/tests/checker/hashable_struct_test.go Show resolved Hide resolved
@SupunS SupunS self-assigned this Oct 26, 2023
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

runtime/sema/path_type.go Show resolved Hide resolved
runtime/tests/checker/hashable_struct_test.go Show resolved Hide resolved
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great work! 👌

@SupunS SupunS merged commit 323b887 into onflow:master Oct 27, 2023
10 of 14 checks passed
@darkdrag00nv2 darkdrag00nv2 deleted the hashable_struct branch October 28, 2023 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HashableStruct type
3 participants