Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19360.8">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19361.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>a6ae1b637ed236354529992729af875f6c8a180a</Sha>
<Sha>f1b09644408f45f43f5835786b3e4bdfd2e78141</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
11 changes: 8 additions & 3 deletions src/absil/ilwritepdb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 50 additions & 0 deletions tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs
Original file line number Diff line number Diff line change
@@ -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

[<TestFixture>]
module ``Else branch is missing`` =

[<Test>]
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'."

[<Test>]
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' "

[<Test>]
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'."
3 changes: 2 additions & 1 deletion tests/fsharp/FSharpSuite.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
Expand Down Expand Up @@ -33,6 +33,7 @@
<Compile Include="Compiler\ILChecker.fs" />
<Compile Include="Compiler\CompilerAssert.fs" />
<Compile Include="Compiler\ErrorMessages\ElseBranchHasWrongTypeTests.fs" />
<Compile Include="Compiler\ErrorMessages\MissingElseBranch.fs" />
<Compile Include="Compiler\SourceTextTests.fs" />
<Compile Include="Compiler\Language\AnonRecordTests.fs" />
<Compile Include="Compiler\Language\SpanOptimizationTests.fs" />
Expand Down
8 changes: 0 additions & 8 deletions tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs

This file was deleted.

10 changes: 0 additions & 10 deletions tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/fsharpqa/Source/Warnings/env.lst
Original file line number Diff line number Diff line change
@@ -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
Expand Down