diff --git a/src/lowering/calls.rs b/src/lowering/calls.rs index 7d06eff9f3..32d603609d 100644 --- a/src/lowering/calls.rs +++ b/src/lowering/calls.rs @@ -261,7 +261,7 @@ impl AstVisitorMut for AggregateTypeLowerer { None, original_location.clone(), ); - //If the function has an implicit call (foo(x := 1)), we need to add an assignment to the reference + //If the function call has formal arguments (foo(x := 1)), we need to add an assignment to the reference let reference = if stmt .parameters .as_ref() diff --git a/tests/lit/single/methods/method_var_output.st b/tests/lit/single/methods/method_var_output.st new file mode 100644 index 0000000000..9fb9a26822 --- /dev/null +++ b/tests/lit/single/methods/method_var_output.st @@ -0,0 +1,21 @@ +// RUN: (%COMPILE %s && %RUN) | %CHECK %s +FUNCTION_BLOCK foo +METHOD baz +VAR_OUTPUT + out : STRING; +END_VAR + out := 'hello'; +END_METHOD +END_FUNCTION_BLOCK + +FUNCTION main +VAR + s: STRING; + fb: foo; +END_VAR + fb.baz(out => s); + printf('%s$n', REF(s)); // CHECK: hello + s := ''; + fb.baz(s); // TODO: need validation here + printf('%s$n', REF(s)); // CHECK: hello +END_FUNCTION \ No newline at end of file