diff --git a/src/FsCheck/Reflect.fs b/src/FsCheck/Reflect.fs index 813952fb..c0685cdb 100644 --- a/src/FsCheck/Reflect.fs +++ b/src/FsCheck/Reflect.fs @@ -23,7 +23,7 @@ module internal Reflect = // ||| BindingFlags.NonPublic ||| BindingFlags.Public let isRecordType (ty : Type) = FSharpType.IsRecord(ty, true) //recordFieldBindingFlags) - let isUnionType ty = FSharpType.IsUnion ty + let isUnionType ty = FSharpType.IsUnion(ty, true) let isTupleType ty = FSharpType.IsTuple ty let getPublicCtors (ty: Type) = ty.GetTypeInfo().DeclaredConstructors |> Seq.filter (fun c -> c.IsPublic) let isCSharpRecordType (ty: Type) = diff --git a/tests/FsCheck.Test/Arbitrary.fs b/tests/FsCheck.Test/Arbitrary.fs index f4410881..269d2946 100644 --- a/tests/FsCheck.Test/Arbitrary.fs +++ b/tests/FsCheck.Test/Arbitrary.fs @@ -413,3 +413,14 @@ module Arbitrary = let ``Derive generator for concrete class with one constructor with two parameters``() = generate |> sample 10 |> ignore + type PrivateRecord = private { a: int; b: string } + + [] + let ``Derive generator for private two value record``() = + generate |> sample 10 |> ignore + + type PrivateUnion = private | Case1 | Case2 of string + + [] + let ``Derive generator for private two case union``() = + generate |> sample 10 |> ignore