Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
Luna-Klatzer opened this issue Jul 25, 2024 · 0 comments
Open
3 tasks done
Assignees
Labels
bug Bug or issue in the language or API
Milestone

Comments

@Luna-Klatzer
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

I am following the documentation's guide

  • I have read the documentation

This issue exists in the latest version

  • I am using 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

  • The compiler should check whether the provided expression matches the type which should be returned by the lambda.
  • The compiler should check the code paths inside a provided compound and see whether there is an if-statement.

Steps To Reproduce

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

Environment

  • Kipper: v0.12.0-alpha.2
  • Environment: Node.js 18.18.2
  • Operating System: ArchLinux
@Luna-Klatzer Luna-Klatzer added the bug Bug or issue in the language or API label Jul 25, 2024
@Luna-Klatzer Luna-Klatzer added this to the v0.12.0 milestone Jul 25, 2024
@Luna-Klatzer Luna-Klatzer self-assigned this Jul 25, 2024
@Luna-Klatzer Luna-Klatzer changed the title [Bug] Lambdas don't check for return type with expressions nor compoound statements [Bug] Lambdas don't check for return type with expressions nor compound statements Sep 16, 2024
@Luna-Klatzer Luna-Klatzer modified the milestones: v0.12.0, v0.13.0 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or issue in the language or API
Projects
Development

No branches or pull requests

2 participants