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

Declare post-condition result variable as reference if return type is a resource #905

Merged
merged 5 commits into from
May 17, 2021

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented May 14, 2021

Description

Function post-conditions may use the special variable result, which is the value that is returned from the function.

When the return type of a function is a resource type, then declare the type of the special variable result to be a reference type.

This is a port of

  • dapperlabs/cadence-internal#4
  • a part of dapperlabs/cadence-internal#8

  • 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

@codecov-commenter
Copy link

Codecov Report

Merging #905 (1592c50) into master (932f51f) will decrease coverage by 0.00%.
The diff coverage is 45.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #905      +/-   ##
==========================================
- Coverage   39.99%   39.99%   -0.01%     
==========================================
  Files         254      254              
  Lines       31721    31736      +15     
==========================================
+ Hits        12688    12693       +5     
- Misses      18179    18187       +8     
- Partials      854      856       +2     
Flag Coverage Δ
unittests 39.99% <45.45%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
runtime/sema/check_function.go 0.00% <0.00%> (ø)
runtime/interpreter/interpreter.go 21.13% <66.66%> (+0.23%) ⬆️

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 932f51f...1592c50. Read the comment docs.

@turbolent turbolent merged commit 9281269 into master May 17, 2021
@turbolent turbolent deleted the bastian/resource-result branch May 17, 2021 16:06
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.

3 participants