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

Unable to resolve a generic through assert #908

Open
euclidianAce opened this issue Jan 13, 2025 · 0 comments
Open

Unable to resolve a generic through assert #908

euclidianAce opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@euclidianAce
Copy link
Member

Given the signature of this ivalues function and attempting to use it with assert call as an argument causes an unresolved generic error

local ivalues: function<Value>({any:Value}): function(): Value

local function _list_contains_string(list: {string}, str: string): boolean
   for val in ivalues(assert(list)) do
      if val == str then
         return true
      end
   end
   return false
end
scratch.tl:5:14: types are not comparable for equality: Value (unresolved generic) and string

but removing the assert makes it check just fine.

 local ivalues: function<Value>({any:Value}): function(): Value
 
 local function _list_contains_string(list: {string}, str: string): boolean
-   for val in ivalues(assert(list)) do
+   for val in ivalues(list) do
       if val == str then
          return true
       end
    end
    return false
 end
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