-
Notifications
You must be signed in to change notification settings - Fork 546
Closed
Labels
bugSomething isn't workingSomething isn't workingnew solverThis issue is specific to the new solver.This issue is specific to the new solver.
Description
As of version 0.651, passing a value to a function where the type of the parameter is index<T> and T is a generic type fails, reducing the parameter to never.
In this repro, replacing all occurrances of T in the function set with 'a' results in the parameter being inferred correctly, therefore it should work as a generic parameter as well.
--!strict
--!optimize 2
local t: {
read a: number,
read b: string,
read c: buffer
} = nil::never
local function set<T>(i:T, v:index<typeof(t), T>): () end
--note: the cast to 'a' is a workaround for an unrelated issue, see #1483
set('a'::'a', 1) --Type 'number' could not be converted into 'never'Expected behaviour
The second parameter is inferred as the type of the value at the index of the first parameter (in this case number), matching the behaviour of when T is replaced with 'a'.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnew solverThis issue is specific to the new solver.This issue is specific to the new solver.