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

[Enhancement] Improve fun type matching #2965

Open
d-enk opened this issue Nov 25, 2024 · 1 comment
Open

[Enhancement] Improve fun type matching #2965

d-enk opened this issue Nov 25, 2024 · 1 comment

Comments

@d-enk
Copy link
Contributor

d-enk commented Nov 25, 2024

---@class Class
---@field f fun(s: string): integer

---@param f fun(x: string): integer
local function handle(f)
	return f("string")
end

-----

---@param i number
---@return boolean
local function is_positive(i)
	return i >= 0
end

handle(is_positive) -- expect `param-type-mismatch`

---@type Class
local _ = { f = is_positive } -- expect `assign-type-mismatch`

Expected warning:
Type fun(i: number):boolean cannot match fun(x: string):integer

I didn't find duplicates, although I expected them
maybe I didn't search well

@tomlau10
Copy link
Contributor

similar issue: #2702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants