Created
February 23, 2014 10:55
-
-
Save dtchepak/9169907 to your computer and use it in GitHub Desktop.
Private constructor in sum type crashes `sprintf "%A"`?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyModule | |
open Xunit | |
open FsUnit.Xunit | |
type Sample = Sample of int | |
with override x.ToString() = sprintf "%A" x | |
[<Fact>] | |
let ``sample to string`` ()= | |
let actual = Sample 1 | |
actual.ToString() // all good | |
type Sample2 = private Sample2 of int | |
with override x.ToString() = sprintf "%A" x | |
[<Fact>] | |
let ``sample2 to string`` ()= | |
let actual = Sample2 1 | |
actual.ToString() // Stack overflow?!??! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment