-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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