diff --git a/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj b/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj index f48ce0fcbf3..7e6d580c483 100644 --- a/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj +++ b/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj @@ -65,6 +65,7 @@ + diff --git a/src/fsharp/FSharp.Compiler.Unittests/RecordInitialisation.fs b/src/fsharp/FSharp.Compiler.Unittests/RecordInitialisation.fs new file mode 100644 index 00000000000..f3c02e9049d --- /dev/null +++ b/src/fsharp/FSharp.Compiler.Unittests/RecordInitialisation.fs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +namespace FSharp.Compiler.Unittests + +open System +open System.Text +open NUnit.Framework +open Microsoft.FSharp.Compiler + +type Foo = { + A : int + B : int + C : int +} + +[] +type OrderOfRecordInitialisation() = + + [] + member this.ShouldInitialzeInGivenOrder() = + let order = ref "" + let _ = + { A = let _ = order := !order + "1" in 0 + C = let _ = order := !order + "2" in 0 + B = let _ = order := !order + "3" in 0 } + + Assert.AreEqual(!order, "123") + \ No newline at end of file