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

fix(compiler): Passed function is not handled correctly [LNG-260] #940

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

InversionSpaces
Copy link
Contributor

@InversionSpaces InversionSpaces commented Oct 23, 2023

Description

Fix renaming to fix incorrect code generation for nested function passing.

Proposed Changes

Fix renaming of AssignmentTag.

Implementation Details

Fix renaming inside AssignmentTag.

Checklist

  • Corresponding issue has been created and linked in PR title.
  • Proposed changes are covered by tests.
  • Documentation has been updated to reflect the changes (if applicable).
  • I have self-reviewed my code and ensured its quality.
  • I have added/updated necessary comments to aid understanding.

Reviewer Checklist

  • Tests have been reviewed and are sufficient to validate the changes.
  • Documentation has been reviewed and is up to date.
  • Any questions or concerns have been addressed.

@linear
Copy link

linear bot commented Oct 23, 2023

LNG-260 Passed function is not handled correctly

aqua:

func cmp(pred: i8 -> bool) -> ?bool:
    result: ?bool

    result <- pred(0)

    <- result

func gt() -> ?bool:
    pred = (ord: i8) -> bool:
        <- ord > 0

    <- cmp(pred)

func test() -> ?bool:
    <- gt()

air:

(xor
 (seq
  (seq
   (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
   (new $result
    (seq
     (seq
      (ap -return-fix-0-0 $result) ;; -return-fix-0-0 is not defined
      (canon %init_peer_id% $result  #-result-fix-0)
     )
     (ap #-result-fix-0 -result-flat-0)
    )
   )
  )
  (call %init_peer_id% ("callbackSrv" "response") [-result-flat-0])
 )
 (call %init_peer_id% ("errorHandlingSrv" "error") [:error: 0])
)

-return-fix-0-0 is not defined

@@ -296,7 +296,7 @@ case class ClosureTag(
copy(
func.copy(arrow =
func.arrow.copy(
ret = func.arrow.ret.map(_.map(f)),
ret = func.arrow.ret.map(_.mapValues(f)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The actual fix

@InversionSpaces InversionSpaces added the e2e Run e2e workflow label Oct 23, 2023
@InversionSpaces InversionSpaces enabled auto-merge (squash) October 23, 2023 10:32
@InversionSpaces InversionSpaces merged commit c83d69e into main Oct 23, 2023
9 checks passed
@InversionSpaces InversionSpaces deleted the fix/function-pass-LNG-260 branch October 23, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants