Fable icon indicating copy to clipboard operation
Fable copied to clipboard

int list is not a union type in Fable

Open njlr opened this issue 2 years ago • 0 comments

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

njlr avatar Sep 01 '23 21:09 njlr