Fable
Fable copied to clipboard
int list is not a union type in Fable
Description
int list (or any other list) is not a union type in Fable.
Repro code
open System
open FSharp.Reflection
let isUnionType (ty : Type) =
FSharpType.IsUnion(ty, true)
let isListType (ty : Type) =
ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof<list<_>>
let ty = typeof<int list>
printfn $"%b{isUnionType ty}"
printfn $"%b{isListType ty}"
Expected and actual results
Expect this in .NET and Fable:
true
true
But Fable gives:
false
true
Related information
- Fable version:
4.1.4 - Operating system:
Ubuntu 22.04