diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8de3807c90d..03b4cb55daf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,12 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: { "name": "F#", - "image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.3", + "image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.5", "features": { - "ghcr.io/devcontainers/features/common-utils:2.4.2": {}, + "ghcr.io/devcontainers/features/common-utils:2.4.3": {}, "ghcr.io/devcontainers/features/git:1.2.0": {}, "ghcr.io/devcontainers/features/github-cli:1.0.11": {}, - "ghcr.io/devcontainers/features/dotnet:2.0.5": {} + "ghcr.io/devcontainers/features/dotnet:2.1.0": {} }, "hostRequirements": { "cpus": 2, diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 4f6d3b767b5..6003c7f7cb3 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -361,7 +361,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str $testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml" $testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog" $args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""nunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath" - $args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration" + $args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false" if (-not $noVisualStudio -or $norestore) { $args += " --no-restore" diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index bd4b7f794d0..c14c248d78a 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -9,16 +9,16 @@ These will go away when repo updates targeting to net8.0 Tracked with https://github.com/dotnet/fsharp/issues/14765 --> - - - + + + - - - + + + diff --git a/eng/build.sh b/eng/build.sh index ce85f543ef9..61c9ddc42cf 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -209,7 +209,7 @@ function Test() { projectname=$(basename -- "$testproject") projectname="${projectname%.*}" testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml" - args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration" + args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false" "$DOTNET_INSTALL_DIR/dotnet" $args || exit $? } diff --git a/global.json b/global.json index ac61062b1c7..a4c3420ed66 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,10 @@ { "sdk": { - "version": "9.0.100-preview.3.24204.13", + "version": "9.0.100-preview.5.24307.3", "allowPrerelease": true }, "tools": { - "dotnet": "9.0.100-preview.3.24204.13", + "dotnet": "9.0.100-preview.5.24307.3", "vs": { "version": "17.8", "components": [ diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index a7672d9925f..727ed166b86 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -3,6 +3,10 @@ // Various tests for the: // Microsoft.FSharp.Core.Operators module +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + namespace FSharp.Core.UnitTests.Operators open System @@ -278,18 +282,24 @@ type OperatorsModule1() = // Overflow let result = Operators.byte Single.MinValue Assert.AreEqual(0uy, result) - + // Overflow let result = Operators.byte Single.MaxValue - Assert.AreEqual(0uy, result) - + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) + // Overflow let result = Operators.byte Double.MinValue Assert.AreEqual(0uy, result) - + // Overflow let result = Operators.byte Double.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte (Int64.MaxValue * 8L) @@ -343,9 +353,15 @@ type OperatorsModule1() = // Overflow Assert.AreEqual('\000', Operators.char Single.MinValue) - Assert.AreEqual('\000', Operators.char Double.MinValue) - Assert.AreEqual('\000', Operators.char Single.MaxValue) - Assert.AreEqual('\000', Operators.char Double.MaxValue) + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Single.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Single.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Double.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Double.MaxValue) CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index d4197529ea6..57647ead9ed 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -3,6 +3,10 @@ // Various tests for the: // Microsoft.FSharp.Core.Operators module +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + namespace FSharp.Core.UnitTests.Operators open System @@ -53,7 +57,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Single.MinValue @@ -61,7 +68,10 @@ type OperatorsModule2() = // Overflow let result = Operators.int Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Double.MinValue @@ -106,7 +116,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int16 Single.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Single.MinValue @@ -114,7 +127,10 @@ type OperatorsModule2() = // Overflow let result = Operators.int16 Double.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Double.MinValue @@ -158,7 +174,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int32 Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Single.MinValue @@ -166,8 +185,11 @@ type OperatorsModule2() = // Overflow let result = Operators.int32 Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) - + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) + // Overflow let result = Operators.int32 Double.MinValue Assert.AreEqual(Int32.MinValue, result) @@ -211,7 +233,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int64 Single.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Single.MinValue @@ -219,7 +244,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int64 Double.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Double.MinValue @@ -365,8 +393,11 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) // Overflow (depends on pointer size) let result = Operators.nativeint Single.MinValue @@ -381,9 +412,12 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Double.MinValue if Info.isX86Runtime then @@ -414,8 +448,11 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual("-9223372036854775808", string result) + if Info.isNetFramework then + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + else + Assert.AreEqual(9223372036854775807n, result) let result = Operators.nativeint System.Double.MinValue if Info.isX86Runtime then @@ -433,7 +470,6 @@ type OperatorsModule2() = Assert.AreEqual("-9223372036854775808", string -9223372036854775808n) Assert.AreEqual("9223372036854775807", string 9223372036854775807n) - [] member _.not() = let result = Operators.not true @@ -445,7 +481,6 @@ type OperatorsModule2() = [] member _.nullArg() = CheckThrowsArgumentNullException(fun () -> Operators.nullArg "A" |> ignore) - [] member _.pown() = @@ -483,7 +518,6 @@ type OperatorsModule2() = member _.raise() = CheckThrowsArgumentException(fun () -> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) - [] member _.ref() = // value type @@ -596,7 +630,10 @@ type OperatorsModule2() = // Overflow let result = Operators.sbyte Double.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte (Int64.MaxValue * 8L) @@ -954,7 +991,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint16 Single.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Single.MinValue @@ -962,7 +1002,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint16 Double.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Double.MinValue @@ -987,7 +1030,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint32 Single.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Single.MinValue @@ -995,7 +1041,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint32 Double.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Double.MinValue @@ -1037,19 +1086,31 @@ type OperatorsModule2() = // Overflow let result = Operators.uint64 Single.MaxValue - Assert.AreEqual(0UL, result) + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) // Overflow let result = Operators.uint64 Single.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Double.MaxValue - Assert.AreEqual(0UL, result) + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) // Overflow let result = Operators.uint64 Double.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Int64.MinValue @@ -1079,25 +1140,37 @@ type OperatorsModule2() = // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Single.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Int64.MinValue diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs index 9af581dca52..7d8b3678821 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs @@ -7,6 +7,10 @@ namespace FSharp.Core.UnitTests.Operators open System open Xunit +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + #nowarn "1204" // CompilerMessage: This function is for use by dynamic invocations of F# code and should not be used directly module OperatorsModuleDynamic = @@ -94,7 +98,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.byte Single.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte Double.MinValue @@ -102,7 +109,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.byte Double.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte (Int64.MaxValue * 8L) @@ -135,8 +145,16 @@ module OperatorsModuleDynamic = // Overflow Assert.AreEqual('\000', Operators.char Single.MinValue) Assert.AreEqual('\000', Operators.char Double.MinValue) - Assert.AreEqual('\000', Operators.char Single.MaxValue) - Assert.AreEqual('\000', Operators.char Double.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Single.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Single.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Double.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Double.MaxValue) CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type @@ -233,7 +251,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Single.MinValue @@ -241,7 +262,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Double.MinValue @@ -286,7 +310,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int16 Single.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Single.MinValue @@ -294,7 +321,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int16 Double.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Double.MinValue @@ -338,7 +368,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int32 Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Single.MinValue @@ -346,7 +379,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int32 Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Double.MinValue @@ -391,7 +427,10 @@ module OperatorsModuleDynamic = // Overflow. let result = Operators.int64 Single.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Single.MinValue @@ -399,7 +438,10 @@ module OperatorsModuleDynamic = // Overflow. let result = Operators.int64 Double.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Double.MinValue @@ -444,9 +486,12 @@ module OperatorsModuleDynamic = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Single.MinValue if Info.isX86Runtime then @@ -454,15 +499,18 @@ module OperatorsModuleDynamic = else // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual(-9223372036854775807n - 1n, result) - + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.nativeint Double.MaxValue if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Double.MinValue if Info.isX86Runtime then @@ -470,7 +518,7 @@ module OperatorsModuleDynamic = else // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual(-9223372036854775807n - 1n, result) - + // Overflow (depends on pointer size) let result = Operators.nativeint Int64.MinValue if Info.isX86Runtime then @@ -492,8 +540,11 @@ module OperatorsModuleDynamic = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual("-9223372036854775808", string result) + if Info.isNetFramework then + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + else + Assert.AreEqual(9223372036854775807n, result) let result = Operators.nativeint System.Double.MinValue if Info.isX86Runtime then @@ -501,7 +552,6 @@ module OperatorsModuleDynamic = else // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual("-9223372036854775808", string result) - // Max and min value as literals (this breaks compilation if the lexer fails). // The following tests ensure that the proper value is parsed, which is similar to `nativeint Int64.MaxValue` etc. if Info.isX86Runtime then @@ -544,7 +594,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.sbyte Single.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte Double.MinValue @@ -552,7 +605,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.sbyte Double.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte (Int64.MaxValue * 8L) @@ -596,7 +652,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint16 Single.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Single.MinValue @@ -604,7 +663,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint16 Double.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Double.MinValue @@ -629,7 +691,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint32 Single.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Single.MinValue @@ -637,8 +702,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint32 Double.MaxValue - Assert.AreEqual(0u, result) - + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Double.MinValue Assert.AreEqual(0u, result) @@ -679,20 +746,31 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint64 Single.MaxValue - Assert.AreEqual(0UL, result) - + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) + // Overflow let result = Operators.uint64 Single.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) + // Overflow let result = Operators.uint64 Double.MaxValue - Assert.AreEqual(0UL, result) - + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) + // Overflow let result = Operators.uint64 Double.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Int64.MinValue Assert.AreEqual(9223372036854775808UL, result) @@ -721,26 +799,37 @@ module OperatorsModuleDynamic = // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Single.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Int64.MinValue if Info.isX86Runtime then