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
somewhat surprisingly produces "not Color" when called on Color("primary").
However, the optimizer treats this like a regular variant and so constant folding f(Color("primary")) produces "primary", which differs from the result of the generated JS.
as discussed today, there are two issues here, the wrong inlining/optimization when using a literal and the use of literal inside the "catch-all" case.
There are 3 things we could do:
check if the inlining/optimization can be improved (but the semantic here is unclear anyway)
raise a warning when using a catch-all case with a literal (it was not really meant to be used that way, it was designed to handle the cases not handled at compile time, otherwise the defined variant cases are here for that)
even better, raise a warning only when using in the catch-all case a literal that overlaps with the existing defined variant cases
Given an unboxed variant like this,
Primary
has the same runtime representation asColor("primary")
This means that a function like
somewhat surprisingly produces
"not Color"
when called onColor("primary")
.However, the optimizer treats this like a regular variant and so constant folding
f(Color("primary"))
produces"primary"
, which differs from the result of the generated JS.Full playground example
The text was updated successfully, but these errors were encountered: