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

Excess type annotations are not errors/warnings #867

Open
euclidianAce opened this issue Dec 6, 2024 · 1 comment
Open

Excess type annotations are not errors/warnings #867

euclidianAce opened this issue Dec 6, 2024 · 1 comment
Labels
bug Something isn't working semantics Unexpected or unsound behaviors

Comments

@euclidianAce
Copy link
Member

This program unexpectedly compiles with no error or warning about the superfluous type annotation

local x: integer, string = 1

It's probably worth it to emit an error or warning when the number of types is greater than the number of variables declared.

The troublesome part of making this an error or warning could prevent some obscure corner case of using an annotation for bidirectional inference regarding generic function returns.

Even this contrived example is probably better off without the annotation but is technically a use case:

global func: function<T, U>(U): T, U
local x: integer, string = func(1)
@hishamhm hishamhm added bug Something isn't working semantics Unexpected or unsound behaviors labels Dec 6, 2024
@hishamhm
Copy link
Member

hishamhm commented Dec 6, 2024

Oh, good call with the latter example there, though it might be simpler to treat the whole count mismatch as a bug and require that the user does local x, _ there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semantics Unexpected or unsound behaviors
Projects
None yet
Development

No branches or pull requests

2 participants