Skip to content

Commit 1ad5657

Browse files
authored
Merge pull request #7222 from dotnet/merges/master-to-release/dev16.3
Merge master to release/dev16.3
2 parents 2fabdaa + 59bfc83 commit 1ad5657

8 files changed

Lines changed: 55 additions & 33 deletions

File tree

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19360.8">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19361.7">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>a6ae1b637ed236354529992729af875f6c8a180a</Sha>
8+
<Sha>f1b09644408f45f43f5835786b3e4bdfd2e78141</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8",
13+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19361.7",
1414
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1515
}
1616
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.Compiler.SourceCodeServices
7+
8+
[<TestFixture>]
9+
module ``Else branch is missing`` =
10+
11+
[<Test>]
12+
let ``Fail if else branch is missing``() =
13+
CompilerAssert.TypeCheckSingleError
14+
"""
15+
let x = 10
16+
let y =
17+
if x > 10 then "test"
18+
"""
19+
FSharpErrorSeverity.Error
20+
1
21+
(4, 19, 4, 25)
22+
"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'."
23+
24+
[<Test>]
25+
let ``Fail on type error in condition``() =
26+
CompilerAssert.TypeCheckSingleError
27+
"""
28+
let x = 10
29+
let y =
30+
if x > 10 then
31+
if x <> "test" then printfn "test"
32+
()
33+
"""
34+
FSharpErrorSeverity.Error
35+
1
36+
(5, 14, 5, 20)
37+
"This expression was expected to have type\n 'int' \nbut here has type\n 'string' "
38+
39+
[<Test>]
40+
let ``Fail if else branch is missing in nesting``() =
41+
CompilerAssert.TypeCheckSingleError
42+
"""
43+
let x = 10
44+
let y =
45+
if x > 10 then ("test")
46+
"""
47+
FSharpErrorSeverity.Error
48+
1
49+
(4, 20, 4, 26)
50+
"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'."

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33

44
<PropertyGroup>
@@ -33,6 +33,7 @@
3333
<Compile Include="Compiler\ILChecker.fs" />
3434
<Compile Include="Compiler\CompilerAssert.fs" />
3535
<Compile Include="Compiler\ErrorMessages\ElseBranchHasWrongTypeTests.fs" />
36+
<Compile Include="Compiler\ErrorMessages\MissingElseBranch.fs" />
3637
<Compile Include="Compiler\SourceTextTests.fs" />
3738
<Compile Include="Compiler\Language\AnonRecordTests.fs" />
3839
<Compile Include="Compiler\Language\SpanOptimizationTests.fs" />

tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/env.lst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs
2-
SOURCE=WarnIfMissingElseBranch.fs # WarnIfMissingElseBranch.fs
3-
SOURCE=WarnIfMissingElseBranch2.fs # WarnIfMissingElseBranch2.fs
4-
SOURCE=WarnIfMissingElseBranch3.fs # WarnIfMissingElseBranch3.fs
52
SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs
63
SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs
74
SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs

0 commit comments

Comments
 (0)