You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Luau 0.658
No error when calling a function with an invalid overload, but I expect an error.
I think all arguments to the overload need to be individually correct, so nset(c1, true) will error because there is no overload with a 2nd argument boolean.
--!stricttypenset= (component_1, component_1) -> () &
(component_2, component_2) -> ()
localnset:nsettypecomponent_1=stringtypecomponent_2=numberlocalc1:stringnset(c1, 1) -- Should error but doesn't, invalid overload--[[ local nset: ((number, number) -> ()) & ((string, string) -> ())]]
But the equivalent type function does error as expected:
--!stricttypecomponent_1=stringtypecomponent_2=numbertypefunctions(components)
localintersection=nillocalfunctionadd(component)
localnewfunction=types.newfunction({
head= {
component,
component,
}
})
intersection=ifintersectionthentypes.intersectionof(intersection, newfunction) elsenewfunctionendifcomponents:is("union") thenfor_, componentincomponents:components() doadd(component)
endelseadd(components)
endifintersectionthenreturnintersectionelsereturntypes.singleton(nil)
endendlocalc1:stringlocalmset:s<component_1|component_2>
mset(c1, 1) -- Fine, TypeError: None of the overloads for function that accept 2 arguments are compatible.--[[ local mset: ((number, number) -> ()) & ((string, string) -> ())]]
The text was updated successfully, but these errors were encountered:
Luau 0.658
No error when calling a function with an invalid overload, but I expect an error.
I think all arguments to the overload need to be individually correct, so
nset(c1, true)
will error because there is no overload with a 2nd argumentboolean
.But the equivalent type function does error as expected:
The text was updated successfully, but these errors were encountered: