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

Add converter functions to produce path values from strings #1211

Merged
merged 11 commits into from
Nov 5, 2021

Conversation

dsainati1
Copy link
Contributor

@dsainati1 dsainati1 commented Nov 1, 2021

Closes #1105

Description

This adds three converter functions to produce paths from strings:

fun PublicPath(_ identifier: string): PublicPath?
fun PrivatePath(_ identifier: string): PrivatePath?
fun StoragePath(_ identifier: string): StoragePath?

  • 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
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.

👍

runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/sema/check_path_expression.go Outdated Show resolved Hide resolved
runtime/sema/check_path_expression.go Outdated Show resolved Hide resolved
runtime/sema/errors.go Outdated Show resolved Hide resolved
runtime/sema/type.go Outdated Show resolved Hide resolved
runtime/tests/interpreter/path_test.go Outdated Show resolved Hide resolved
runtime/tests/interpreter/path_test.go Outdated Show resolved Hide resolved
runtime/tests/interpreter/path_test.go Outdated Show resolved Hide resolved
runtime/tests/interpreter/path_test.go Outdated Show resolved Hide resolved
runtime/tests/checker/path_test.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2021

Codecov Report

Merging #1211 (c14c075) into master (2b9ff0d) will increase coverage by 0.23%.
The diff coverage is 89.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1211      +/-   ##
==========================================
+ Coverage   76.91%   77.14%   +0.23%     
==========================================
  Files         272      272              
  Lines       33887    33989     +102     
==========================================
+ Hits        26065    26222     +157     
+ Misses       6724     6703      -21     
+ Partials     1098     1064      -34     
Flag Coverage Δ
unittests 77.14% <89.02%> (+0.23%) ⬆️

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

Impacted Files Coverage Δ
runtime/interpreter/interpreter.go 87.92% <ø> (ø)
runtime/literal.go 86.36% <42.85%> (-1.88%) ⬇️
runtime/sema/errors.go 58.46% <50.00%> (-0.08%) ⬇️
runtime/sema/check_path_expression.go 85.18% <85.71%> (-3.71%) ⬇️
runtime/interpreter/value.go 82.32% <87.50%> (+1.49%) ⬆️
runtime/sema/type.go 87.76% <100.00%> (+0.22%) ⬆️
runtime/interpreter/conversion.go 95.12% <0.00%> (ø)
runtime/common/address.go 92.30% <0.00%> (+0.30%) ⬆️
runtime/interpreter/primitivestatictype.go 74.29% <0.00%> (+1.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b9ff0d...c14c075. Read the comment docs.

runtime/sema/errors.go Show resolved Hide resolved
runtime/literal.go Outdated Show resolved Hide resolved
runtime/sema/check_path_expression.go Outdated Show resolved Hide resolved
runtime/sema/check_path_expression.go Outdated Show resolved Hide resolved
runtime/sema/type.go Show resolved Hide resolved
docs/language/accounts.mdx Outdated Show resolved Hide resolved
runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/sema/type.go Outdated 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! 👏

@dsainati1 dsainati1 merged commit 8c6b07d into master Nov 5, 2021
@dsainati1 dsainati1 deleted the issue1105 branch November 5, 2021 17:24
@turbolent
Copy link
Member

@dsainati1 There has been many requests from the community for this feature. Maybe we can backport it to v0.23 to get it out earlier?

@dsainati1 dsainati1 mentioned this pull request Feb 18, 2022
6 tasks
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 support for casting String to *Path (StoragePath or CapabilityPath)
3 participants