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
typeUse=<T>(UsedAs<T>) ->TtypeUsedAs<T>=T | {T} -- approximation of the real type in Fusion-- only care about the static types, this doesn't need to runlocaluse: Use=nil :: anylocalinput: UsedAs<number>=nil :: any-- `output` inferred to be a free type, rather than the expected `number`localoutput=use(input)
This relates to the currently-suboptimal type inference for use functions.
The new solver doesn't entirely solve for this, though it does give a "yes, technically" kind of answer.
It currently matches T to number | {number} and then substitutes it to get (number | {number} | {number | {number}}) -> number | {number}
I'll make a ticket for it though. We should be able to get it to do some structural matching to try to get the smallest possible type for the instantiation.
(and if we couldn't, that'd actually be a really strong motivator for adding explicit instantiation syntax for all those turbofish-heads out there.)
The text was updated successfully, but these errors were encountered:
<T>(T | {T}) -> T
creates a free type when called.This relates to the currently-suboptimal type inference for use functions.
The new solver doesn't entirely solve for this, though it does give a "yes, technically" kind of answer.
The text was updated successfully, but these errors were encountered: