luau
luau copied to clipboard
Code is too complex to type check error is too eager with class prototypes in new solver
type BaseButtonPrototype = {
set_active: (plugin_button: { read button: PluginToolbarButton }, active: boolean) -> (),
__index: BaseButtonPrototype
}
type PluginActionButtonPrototype = BaseButtonPrototype & {
on_trigger: (plugin_action_button: PluginActionButton, f: () -> ()) -> (() -> ()),
__index: PluginActionButtonPrototype,
}
export type PluginActionButton = typeof(setmetatable({} :: {
read button: PluginToolbarButton,
read action: PluginAction,
enabled: boolean,
-- type error occurs when the cast happens {} :: PluginActionButtonPrototype
-- the type error wont occur if __index is removed from BaseButtonPrototype
-- TypeError: Code is too complex to typecheck! Consider simplifying the code around this area Luau (1035)
}, {} :: PluginActionButtonPrototype))
What do you mean by "too eager?" This error corresponds to hitting internal limitations in certain places, it's certainly fair to say "i feel like it is too restrictive for this code to error," but the phrasing too eager makes me feel like your expectation might be something else?
What do you mean by "too eager?" This error corresponds to hitting internal limitations in certain places, it's certainly fair to say "i feel like it is too restrictive for this code to error," but the phrasing too eager makes me feel like your expectation might be something else?
The former, I just couldn't think of a better title for the report.