aardappel / lobster

The Lobster Programming Language

Home Page:http://strlen.com/lobster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specifying function return types results in an error

AntonBogun opened this issue · comments

The following code

def f() -> [int],int:
    let a=[1]
    return a,1
def f2(l) -> void:
    print(l)
f2(f())

results in the error
run.lobster(3): error: `return` requires type `([int], int)`, got `[int]`
However, removing -> [int],int results in no error and the expected behaviour - printout of [1].

Ahh.. that's because you're calling it in a way that takes only 1 return value, which then removes the 1 and then afterwards complains about it :)

So not intended?

No, this should compile.

Should be fixed here: 76fa822