luau
luau copied to clipboard
New Solver: Type '*no-refine*' could not be converted into 'string' in an invariant context
Minimized example from https://github.com/aatxe/lute/blob/primary/batteries/json.luau
Seems to be due to the interaction with string.match
type DeserializerState = {
src: string,
cursor: number,
}
function deserialize_number(state: DeserializerState)
-- ...
end
function deserialize(state: DeserializerState)
if string.match(state.src, "^[%d%.]", state.cursor) then
-- Errors on "state"
-- TypeError: Type '*no-refine*' could not be converted into 'number' in an invariant context
-- TypeError: Type '*no-refine*' could not be converted into 'string' in an invariant context
deserialize_number(state)
end
end
Example of the state type: