JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Functions with return type should return last expression #164

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 4 years ago

Current Issue

Unless we explicitly end a function with return, it does not return anything.

High-level description of the feature

In Mamba, a function that ends with an expression returns that type as long if the signature states as such.

Description of potential implementation

See #165

JSAbrahams commented 2 years ago

Catagorized this as bug since a few tests already assume this behaviour partially (in the type checker). The generate code stage however does not yet deal with this, so the reference (*_check.py) files always assume no return if not explicit in Mamba.

JSAbrahams commented 1 year ago

Forgot about match arms

JSAbrahams commented 1 year ago

Hm, and ternary expressions?

JSAbrahams commented 1 year ago

Well, it is actually not used in the generate stage anymore. Might be useful though if we want to use an if as an expression in other places (not perse in a function). I'll leave this issue open so I don't forget to make a separate issue for the above.