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

detect mismatch in generics when redeclaring a function #801

Open
hishamhm opened this issue Sep 10, 2024 · 0 comments
Open

detect mismatch in generics when redeclaring a function #801

hishamhm opened this issue Sep 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hishamhm
Copy link
Member

hishamhm commented Sep 10, 2024

This should fail, but it succeeds silently in next and crashes the compiler in 0.15.x.

local type List2 = record<T>
   new: function<U>(initialItems: {T}, u: U): List2<T>
end

function List2.new<U>(initialItems: {T}, u: U): List2<U> -- mismatched return type
end

local type Fruit2 = enum
   "apple"
   "peach"
   "banana"
end

local type L2 = List2<Fruit2>
local lunchbox = L2.new({"apple", "peach"}, true)
@hishamhm hishamhm added the bug Something isn't working label Sep 10, 2024
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

1 participant