-
Notifications
You must be signed in to change notification settings - Fork 323
Latest Fable fails to compile Fable.React #3658
Copy link
Copy link
Closed
Description
Description
.\src\Client\fable_modules\Fable.React.9.3.0\Fable.React.Props.fs(43,5): (43,12) error FABLE: Cannot test erased union cases
This is because the bundled FCS contains dotnet/fsharp#16341, and Fable tries to create case tester functions for every case.
export function HTMLAttr__get_IsHref(this$, unitArg) {
if (this$.tag === 0) {
return true;
}
else {
return false;
}
}
export function HTMLAttr__get_IsCustom(this$, unitArg) {
if (this$.tag === 1) {
return true;
}
else {
return false;
}
}
export const x = HTMLAttr__get_IsCustom(new HTMLAttr(1, []));for
type HTMLAttr =
| Href of string
| Custom
let x = Custom.IsCustomAdding [<Fable.Core.Erase>] to Href or Custom introduces a compiler error.
I suggest Fable is adjusted to recognize the newly exposed case testers and to emit tag comparisons at call sites instead of creating properties. That way compilation will only fail when trying to use a case tester on an erased case.
export const x = (new HTMLAttr(1, [])).tag === 1;Repro code
Related information
- Fable version: 4.8.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels