Kipper-Lang / Kipper

The Kipper programming language for Browsers and Node.js 🦊✨ Made at HTL Leonding & JKU Linz
https://kipper-lang.org
GNU General Public License v3.0
26 stars 4 forks source link

[Bug] Lambdas don't check for return type with expressions nor compoound statements #684

Open Luna-Klatzer opened 1 month ago

Luna-Klatzer commented 1 month ago

Is there an existing issue for this?

I am following the documentation's guide

This issue exists in the latest version

Current Behavior

When defining a lambda you currently need to also directly specify a return type, which makes sense for strict type checking, but the compiler doesn't correctly check the type of the expression or for a return inside the compound statement.

For example:

var x: Func<num> = (): num -> void; // works - no error

Or also with compounds:

var y: Func<num> = (): num -> {}; // works - no error

Expected Behavior

Steps To Reproduce

  1. Define any lambda with an incorrect return expression, missing return statement or invalid return type.

Environment