Skip to content

Nested function invocations behave abnormally #50

@LeonPuchinger

Description

@LeonPuchinger

When calling multiple functions in a row and calling each function with the return value of the previous invocation as a parameter, the language does not act as would be expected. For instance, when we call the function called foo from the example below and pass its return value into print, the console stays blank. However, when the intermediate result is bound to a variable, the program works as expected again. Interestingly, the second, erroneous example does not produce an error during runtime or lead to any static analysis findings.

Working example:

message = "hello"
foo = function(input: String) -> String {
    return input
}
foo_result = foo(message)
print(foo_result) // works as expected

Erroneous version:

message = "hello"
foo = function(input: String) -> String {
    return input
}
print(foo(message)) // does not print anything

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions