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): Fix closure passing [fixes LNG-92] #747

Merged
merged 3 commits into from
Jun 14, 2023
Merged

Conversation

InversionSpaces
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Jun 14, 2023

LNG-92 Passing closures doesn't work (0.7.7-353)

% aqua --version
0.7.7-353
func take_closure(f: string -> bool) -> bool:
  <- f("hello")

func test_pass_closure() -> bool:
  f = (s: string) -> bool:
    <- true

  <- take_closure(f)
% aqua --dry -i closure_race.aqua
2022.10.17 16:14:50:202 main INFO aqua.AquaCli.main:135
    Aqua Compiler 0.7.7-353
2022.10.17 16:14:50 [ERROR] Inlining, cannot find arrow f, available: Srv.list, test, Srv.add_alias, Srv.resolve_alias, Op.string_to_b58, Dist.make_module_config, Kademlia.neighborhood, Dist.add_blueprint, Op.string_from_b58, Script.add_from_vault, Op.identity, Srv.get_interface, Dist.get_module_interface, Script.list, Srv.remove, Sig.sign, Dist.list_blueprints, Op.noop, Debug.stringify, Peer.identify, Sig.verify, Peer.timeout, Peer.connect, Op.array_length, Dist.add_module_from_vault, Script.remove, Peer.get_contact, Dist.make_blueprint, Op.sha256_string, Script.add, Kademlia.merge, Dist.add_module, Srv.create, f-0, Op.bytes_from_b58, Peer.is_connected, Op.array, Sig.get_pub_key, Op.concat_strings, Dist.list_modules, Op.concat, Op.bytes_to_b58, Dist.default_module_config, Peer.timestamp_ms, Peer.timestamp_sec
Source /Users/folex/Development/aqua_scripts/closure_race.aqua: compilation OK

And it generates the following air

; This file is auto-generated. Do not edit manually: changes may be erased.
; Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
; If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
; Aqua version: 0.7.7-353

(xor
 (seq
  (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
  (xor
   (call %init_peer_id% ("callbackSrv" "response") [f-1])
   (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
  )
 )
 (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)

@InversionSpaces InversionSpaces added the e2e Run e2e workflow label Jun 14, 2023
@DieMyst DieMyst merged commit f1abd58 into main Jun 14, 2023
12 checks passed
@DieMyst DieMyst deleted the fix/closure-pass branch June 14, 2023 13:09
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.

None yet

2 participants