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

Regression: Sometimes cannot re-use generic identifiers across unrelated functions #909

Closed
svermeulen opened this issue Jan 14, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@svermeulen
Copy link
Contributor

local record util
end

-- Using 'K' works though:
-- function util.remove<K>(_list:{K}, _item:K)
function util.remove<T>(_list:{T}, _item:T)
   error("not implemented")
end

local function foo<T>(handler:function(T), handlers:{function(T)})
   util.remove(handlers, handler)
end

local handlers:{function(integer)} = {}

local function bar(_value:integer)
   error("not implemented")
end

foo(bar, handlers)

Error:

➜ lua tl check main.tl
========================================
1 error:
main.tl:12:16: argument 1: got {function(T)}, expected {T}
----------------------------------------
@svermeulen
Copy link
Contributor Author

svermeulen commented Jan 14, 2025

Should mention that this worked in previous versions of teal. Also - I'm using tl branch fix-905 from #906

@hishamhm hishamhm added the bug Something isn't working label Jan 14, 2025
@hishamhm
Copy link
Member

Could be similar to #908... I wonder if this one is happening only on fix-905 or master as well.

@hishamhm
Copy link
Member

As I suspected, fix-905 fixes 905 but breaks this (this test case passes on master but not on fix-905).

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

No branches or pull requests

2 participants