diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bfb72eca155..e2195f4bc58 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a6ae1b637ed236354529992729af875f6c8a180a + f1b09644408f45f43f5835786b3e4bdfd2e78141 diff --git a/global.json b/global.json index 60dbe5efe92..ca0cec66a73 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19361.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 260ccbe238e..2a992ed4855 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -403,12 +403,17 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s if i < 1 || offsetDelta > 0 then builder.WriteCompressedInteger offsetDelta - // Hidden-sequence-point-record - if startLine = 0xfeefee || endLine = 0xfeefee || (startColumn = 0 && endColumn = 0) + // Check for hidden-sequence-point-record + if startLine = 0xfeefee || + endLine = 0xfeefee || + (startColumn = 0 && endColumn = 0) || + ((endLine - startLine) = 0 && (endColumn - startColumn) = 0) then + // Hidden-sequence-point-record builder.WriteCompressedInteger 0 builder.WriteCompressedInteger 0 - else // Non-hidden-sequence-point-record + else + // Non-hidden-sequence-point-record let deltaLines = endLine - startLine // lines builder.WriteCompressedInteger deltaLines diff --git a/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs b/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs new file mode 100644 index 00000000000..06f9cb160d9 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Else branch is missing`` = + + [] + let ``Fail if else branch is missing``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then "test" + """ + FSharpErrorSeverity.Error + 1 + (4, 19, 4, 25) + "This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'." + + [] + let ``Fail on type error in condition``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then + if x <> "test" then printfn "test" + () + """ + FSharpErrorSeverity.Error + 1 + (5, 14, 5, 20) + "This expression was expected to have type\n 'int' \nbut here has type\n 'string' " + + [] + let ``Fail if else branch is missing in nesting``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then ("test") + """ + FSharpErrorSeverity.Error + 1 + (4, 20, 4, 26) + "This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'." diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 6335b5172cd..8f450a1b3a8 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -1,4 +1,4 @@ - + @@ -33,6 +33,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs deleted file mode 100644 index 9e6e9d7efe9..00000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'. - -let x = 10 -let y = - if x > 10 then "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs deleted file mode 100644 index a8b98922a0e..00000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//This expression was expected to have type - -let x = 10 -let y = - if x > 10 then - if x <> "test" then printfn "test" - () - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs deleted file mode 100644 index cbf7d5acf16..00000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'. - -let x = 10 -let y = - if x > 10 then ("test") - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 127d78a21c5..f711b79a377 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -1,7 +1,4 @@ SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs - SOURCE=WarnIfMissingElseBranch.fs # WarnIfMissingElseBranch.fs - SOURCE=WarnIfMissingElseBranch2.fs # WarnIfMissingElseBranch2.fs - SOURCE=WarnIfMissingElseBranch3.fs # WarnIfMissingElseBranch3.fs SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs