From 0f24b3ef42cae5d48cdafc0b80dee92de1db10b6 Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Tue, 16 Jul 2019 10:23:25 -0700
Subject: [PATCH 01/22] Update dependencies from
https://github.com/dotnet/arcade build 20190715.4 (#7240)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19365.4
---
eng/Version.Details.xml | 4 ++--
global.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 119dfcd3a41..19eab0f3c7e 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- 0c81c2bbdc49749e9940bc8858ebd16026d51277
+ fb27fd4d8a2b67d4333e33d4b898c65171c9f3c1
diff --git a/global.json b/global.json
index 81be3571adc..616ab02e470 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19364.1",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19365.4",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From 863ec255f4345eb0622673414cdf3052494c5ab4 Mon Sep 17 00:00:00 2001
From: Sergey Tihon
Date: Tue, 16 Jul 2019 20:31:30 +0300
Subject: [PATCH 02/22] Moving UpcastDowncastTests over to NUnit (#7229)
* Moving UpcastDowncastTests over to NUnit
* missing new line
---
.../ErrorMessages/UpcastDowncastTests.fs | 51 +++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 1 +
.../Warnings/DowncastInsteadOfUpcast.fs | 9 ----
.../UpcastFunctionInsteadOfDowncast.fs | 9 ----
.../Warnings/UpcastInsteadOfDowncast.fs | 9 ----
tests/fsharpqa/Source/Warnings/env.lst | 3 --
6 files changed, 52 insertions(+), 30 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs
diff --git a/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs b/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs
new file mode 100644
index 00000000000..739f841bfca
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs
@@ -0,0 +1,51 @@
+// 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 ``Upcast and Downcast`` =
+
+ []
+ let ``Downcast Instead Of Upcast``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+open System.Collections.Generic
+
+let orig = Dictionary() :> IDictionary
+let c = orig :> Dictionary
+ """
+ FSharpErrorSeverity.Error
+ 193
+ (5, 9, 5, 36)
+ "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n"
+
+ []
+ let ``Upcast Instead Of Downcast``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+open System.Collections.Generic
+
+let orig = Dictionary()
+let c = orig :?> IDictionary
+ """
+ [|
+ FSharpErrorSeverity.Warning, 67, (5, 9, 5, 38), "This type test or downcast will always hold"
+ FSharpErrorSeverity.Error, 3198, (5, 9, 5, 38), "The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using the :> (upcast) operator instead of the :?> (downcast) operator."
+ |]
+
+ []
+ let ``Upcast Function Instead Of Downcast``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+open System.Collections.Generic
+
+let orig = Dictionary()
+let c : IDictionary = downcast orig
+ """
+ [|
+ FSharpErrorSeverity.Warning, 67, (5, 32, 5, 45), "This type test or downcast will always hold"
+ FSharpErrorSeverity.Error, 3198, (5, 32, 5, 45), "The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'."
+ |]
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index 55fad20ad29..ec2a852b131 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -36,6 +36,7 @@
+
diff --git a/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs b/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs
deleted file mode 100644
index a815425e294..00000000000
--- a/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #Warnings
-//Type constraint mismatch. The type
-
-open System.Collections.Generic
-
-let orig = Dictionary() :> IDictionary
-let c = orig :> Dictionary
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs b/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs
deleted file mode 100644
index 6bc8c54c124..00000000000
--- a/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #Warnings
-//The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'.
-
-open System.Collections.Generic
-
-let orig = Dictionary()
-let c : IDictionary = downcast orig
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs b/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs
deleted file mode 100644
index 00962a1521b..00000000000
--- a/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #Warnings
-//The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast.
-
-open System.Collections.Generic
-
-let orig = Dictionary()
-let c = orig :?> IDictionary
-
-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 350dc92a0d9..3a31070e079 100644
--- a/tests/fsharpqa/Source/Warnings/env.lst
+++ b/tests/fsharpqa/Source/Warnings/env.lst
@@ -38,9 +38,6 @@
SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs
SOURCE=RefCellInsteadOfNot.fs # RefCellInsteadOfNot.fs
SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs
- SOURCE=UpcastInsteadOfDowncast.fs # UpcastInsteadOfDowncast.fs
- SOURCE=UpcastFunctionInsteadOfDowncast.fs # UpcastFunctionInsteadOfDowncast.fs
- SOURCE=DowncastInsteadOfUpcast.fs # DowncastInsteadOfUpcast.fs
SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs
SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs
SOURCE=WarnIfExpressionResultUnused.fs # WarnIfExpressionResultUnused.fs
From c8bac72813d88e048979dd7160d7edf82700d67a Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Wed, 17 Jul 2019 10:24:11 -0700
Subject: [PATCH 03/22] Update dependencies from
https://github.com/dotnet/arcade build 20190716.4 (#7245)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19366.4
---
eng/Version.Details.xml | 4 ++--
global.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 19eab0f3c7e..86d49308d4e 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- fb27fd4d8a2b67d4333e33d4b898c65171c9f3c1
+ 0dd5e2025f0049c133a8706f40e4463b193e5d17
diff --git a/global.json b/global.json
index 616ab02e470..7d6048be9fe 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19365.4",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19366.4",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From 69805873b502337e8e3d2b1346796cc8ce8b7981 Mon Sep 17 00:00:00 2001
From: Kevin Schneider
Date: Wed, 17 Jul 2019 19:44:10 +0200
Subject: [PATCH 04/22] Move ErrorMessages/NameResolution Tests to NUnit
(#7237)
* Mark name resoltion error message tests for port to NUnit
* Add Nunit tests for FieldNotInRecord, RecordFieldProposal, and GlobalQualifierAfterDot
* Fix expected error message in FieldNotInRecord Compiler test
* Change global Qualifier after dot test back to original fsharpqa version.
Needs seperate assert function for parsing errors instead of typechecking
* Remove unnecessary double ticks from NameResolution tests
---
.../ErrorMessages/NameResolutionTests.fs | 45 +++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 1 +
.../NameResolution/E_FieldNotInRecord.fs | 13 ------
.../E_GlobalQualifierAfterDot.fs | 2 +-
.../NameResolution/E_RecordFieldProposal.fs | 13 ------
.../ErrorMessages/NameResolution/env.lst | 4 +-
6 files changed, 48 insertions(+), 30 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs
diff --git a/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs
new file mode 100644
index 00000000000..70def908d11
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs
@@ -0,0 +1,45 @@
+// 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 NameResolutionTests =
+
+ []
+ let FieldNotInRecord () =
+ CompilerAssert.TypeCheckSingleError
+ """
+type A = { Hello:string; World:string }
+type B = { Size:int; Height:int }
+type C = { Wheels:int }
+type D = { Size:int; Height:int; Walls:int }
+type E = { Unknown:string }
+type F = { Wallis:int; Size:int; Height:int; }
+
+let r:F = { Size=3; Height=4; Wall=1 }
+ """
+ FSharpErrorSeverity.Error
+ 1129
+ (9, 31, 9, 35)
+ "The record type 'F' does not contain a label 'Wall'."
+
+ []
+ let RecordFieldProposal () =
+ CompilerAssert.TypeCheckSingleError
+ """
+type A = { Hello:string; World:string }
+type B = { Size:int; Height:int }
+type C = { Wheels:int }
+type D = { Size:int; Height:int; Walls:int }
+type E = { Unknown:string }
+type F = { Wallis:int; Size:int; Height:int; }
+
+let r = { Size=3; Height=4; Wall=1 }
+ """
+ FSharpErrorSeverity.Error
+ 39
+ (9, 29, 9, 33)
+ "The record label 'Wall' is not defined."
\ No newline at end of file
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index ec2a852b131..fe3d1656a91 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -36,6 +36,7 @@
+
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs
deleted file mode 100644
index 4a5361f8f67..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #ErrorMessages #NameResolution
-//The record type 'F' does not contain a label 'Wall'\.
-
-type A = { Hello:string; World:string }
-type B = { Size:int; Height:int }
-type C = { Wheels:int }
-type D = { Size:int; Height:int; Walls:int }
-type E = { Unknown:string }
-type F = { Wallis:int; Size:int; Height:int; }
-
-let r:F = { Size=3; Height=4; Wall=1 }
-
-exit 0
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
index b369ffad37f..9bde0edbc4f 100644
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
+++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
@@ -3,4 +3,4 @@
let x = global.System.String.Empty.global.System.String.Empty
-exit 0
+exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs
deleted file mode 100644
index ca73d5c1e54..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #ErrorMessages #NameResolution
-//The record label 'Wall' is not defined\.
-
-type A = { Hello:string; World:string }
-type B = { Size:int; Height:int }
-type C = { Wheels:int }
-type D = { Size:int; Height:int; Walls:int }
-type E = { Unknown:string }
-type F = { Wallis:int; Size:int; Height:int; }
-
-let r = { Size=3; Height=4; Wall=1 }
-
-exit 0
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
index 42209ddd28e..71bc0eb3900 100644
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
+++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
@@ -1,3 +1 @@
- SOURCE=E_RecordFieldProposal.fs # E_RecordFieldProposal
- SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot
- SOURCE=E_FieldNotInRecord.fs # E_FieldNotInRecord
\ No newline at end of file
+SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot
\ No newline at end of file
From 4cf7b5bc523d9701f7f0ca22711ed4165bf11afc Mon Sep 17 00:00:00 2001
From: Sergey Tihon
Date: Wed, 17 Jul 2019 21:11:31 +0300
Subject: [PATCH 05/22] Moving WarnExpressionTests over to NUnit (#7232)
---
.../ErrorMessages/WarnExpressionTests.fs | 208 ++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 1 +
.../DontWarnIfPropertyWithoutSetter.fs | 14 --
.../Source/Warnings/WarnIfDiscardedInList.fs | 14 --
.../Source/Warnings/WarnIfDiscardedInList2.fs | 19 --
.../Source/Warnings/WarnIfDiscardedInList3.fs | 19 --
.../Warnings/WarnIfExpressionResultUnused.fs | 5 -
.../Warnings/WarnIfImplicitlyDiscarded.fs | 11 -
.../Warnings/WarnIfPossibleAssignment.fs | 11 -
.../WarnIfPossibleAssignmentToMutable.fs | 11 -
.../WarnIfPossibleDotNetPropertySetter.fs | 13 --
.../Warnings/WarnIfPossiblePropertySetter.fs | 15 --
.../Warnings/WarnOnlyOnLastExpression.fs | 10 -
tests/fsharpqa/Source/Warnings/env.lst | 11 -
14 files changed, 209 insertions(+), 153 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs
diff --git a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
new file mode 100644
index 00000000000..557aa81a4d4
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
@@ -0,0 +1,208 @@
+// 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 ``Warn Expression`` =
+
+ []
+ let ``Warn If Expression Result Unused``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+1 + 2
+printfn "%d" 3
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (2, 1, 2, 6)
+ "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+
+ []
+ let ``Warn If Possible Assignment``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = 10
+let y = "hello"
+
+let changeX() =
+ x = 20
+ y = "test"
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 11)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'."
+
+ []
+ let ``Warn If Possible Assignment To Mutable``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let mutable x = 10
+let y = "hello"
+
+let changeX() =
+ x = 20
+ y = "test"
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 11)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'."
+
+ []
+ let ``Warn If Possible dotnet Property Setter``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+open System
+
+let z = System.Timers.Timer()
+let y = "hello"
+
+let changeProperty() =
+ z.Enabled = true
+ y = "test"
+ """
+ [|
+ FSharpErrorSeverity.Warning, 760, (4, 9, 4, 30), "It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value"
+ FSharpErrorSeverity.Warning, 20, (8, 5, 8, 21), "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'."
+ |]
+
+ []
+ let ``Don't Warn If Property Without Setter``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type MyClass(property1 : int) =
+ member val Property2 = "" with get
+
+let x = MyClass(1)
+let y = "hello"
+
+let changeProperty() =
+ x.Property2 = "22"
+ y = "test"
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (9, 5, 9, 23)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
+
+ []
+ let ``Warn If Implicitly Discarded``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = 10
+let y = 20
+
+let changeX() =
+ y * x = 20
+ y = 30
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 15)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
+
+ []
+ let ``Warn If Discarded In List``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let div _ _ = 1
+let subView _ _ = [1; 2]
+
+// elmish view
+let view model dispatch =
+ [
+ yield! subView model dispatch
+ div [] []
+ ]
+ """
+ FSharpErrorSeverity.Warning
+ 3221
+ (9, 8, 9, 17)
+ "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'."
+
+ []
+ let ``Warn If Discarded In List 2``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+// stupid things to make the sample compile
+let div _ _ = 1
+let subView _ _ = [1; 2]
+let y = 1
+
+// elmish view
+let view model dispatch =
+ [
+ div [] [
+ match y with
+ | 1 -> yield! subView model dispatch
+ | _ -> subView model dispatch
+ ]
+ ]
+ """
+ FSharpErrorSeverity.Warning
+ 3222
+ (13, 19, 13, 41)
+ "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'."
+
+ []
+ let ``Warn If Discarded In List 3``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+// stupid things to make the sample compile
+let div _ _ = 1
+let subView _ _ = true
+let y = 1
+
+// elmish view
+let view model dispatch =
+ [
+ div [] [
+ match y with
+ | 1 -> ()
+ | _ -> subView model dispatch
+ ]
+ ]
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (13, 19, 13, 41)
+ "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+
+ []
+ let ``Warn Only On Last Expression``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let mutable x = 0
+while x < 1 do
+ printfn "unneeded"
+ x <- x + 1
+ true
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 9)
+ "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+
+ []
+ let ``Warn If Possible Property Setter``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type MyClass(property1 : int) =
+ member val Property1 = property1
+ member val Property2 = "" with get, set
+
+let x = MyClass(1)
+let y = "hello"
+
+let changeProperty() =
+ x.Property2 = "20"
+ y = "test"
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (10, 5, 10, 23)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'."
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index fe3d1656a91..b1bb4c1e33a 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -38,6 +38,7 @@
+
diff --git a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs b/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs
deleted file mode 100644
index 4492e6338c6..00000000000
--- a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Warnings
-//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.
-
-type MyClass(property1 : int) =
- member val Property2 = "" with get
-
-let x = MyClass(1)
-let y = "hello"
-
-let changeProperty() =
- x.Property2 = "22"
- y = "test"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs
deleted file mode 100644
index d47a4c13769..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Warnings
-//
-
-let div _ _ = 1
-let subView _ _ = [1; 2]
-
-// elmish view
-let view model dispatch =
- [
- yield! subView model dispatch
- div [] []
- ]
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs
deleted file mode 100644
index d360da4d666..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs
+++ /dev/null
@@ -1,19 +0,0 @@
-// #Warnings
-//
-
-// stupid things to make the sample compile
-let div _ _ = 1
-let subView _ _ = [1; 2]
-let y = 1
-
-// elmish view
-let view model dispatch =
- [
- div [] [
- match y with
- | 1 -> yield! subView model dispatch
- | _ -> subView model dispatch
- ]
- ]
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs
deleted file mode 100644
index 238d4388f9e..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs
+++ /dev/null
@@ -1,19 +0,0 @@
-// #Warnings
-//
-
-// stupid things to make the sample compile
-let div _ _ = 1
-let subView _ _ = true
-let y = 1
-
-// elmish view
-let view model dispatch =
- [
- div [] [
- match y with
- | 1 -> ()
- | _ -> subView model dispatch
- ]
- ]
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs b/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs
deleted file mode 100644
index 9480f35b6b6..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs
+++ /dev/null
@@ -1,5 +0,0 @@
-// #Warnings
-//The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$
-
-1 + 2
-printfn "%d" 3
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs b/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs
deleted file mode 100644
index ad7f9deacdd..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs
+++ /dev/null
@@ -1,11 +0,0 @@
-// #Warnings
-//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.
-
-let x = 10
-let y = 20
-
-let changeX() =
- y * x = 20
- y = 30
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs
deleted file mode 100644
index b3fca3a0b92..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs
+++ /dev/null
@@ -1,11 +0,0 @@
-// #Warnings
-//If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'.
-
-let x = 10
-let y = "hello"
-
-let changeX() =
- x = 20
- y = "test"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs
deleted file mode 100644
index bd827ec4adc..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs
+++ /dev/null
@@ -1,11 +0,0 @@
-// #Warnings
-//If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'.
-
-let mutable x = 10
-let y = "hello"
-
-let changeX() =
- x = 20
- y = "test"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs
deleted file mode 100644
index 7c461349ec2..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Warnings
-//If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'
-
-open System
-
-let z = System.Timers.Timer()
-let y = "hello"
-
-let changeProperty() =
- z.Enabled = true
- y = "test"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs
deleted file mode 100644
index 7548d204685..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs
+++ /dev/null
@@ -1,15 +0,0 @@
-// #Warnings
-//If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'
-
-type MyClass(property1 : int) =
- member val Property1 = property1
- member val Property2 = "" with get, set
-
-let x = MyClass(1)
-let y = "hello"
-
-let changeProperty() =
- x.Property2 = "20"
- y = "test"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs b/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs
deleted file mode 100644
index 7b0b968c23b..00000000000
--- a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs
+++ /dev/null
@@ -1,10 +0,0 @@
-// #Warnings
-//The result of this expression has type 'bool' and is implicitly ignored
-
-let mutable x = 0
-while x < 1 do
- printfn "unneeded"
- x <- x + 1
- true
-
-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 3a31070e079..9b5fbffaeba 100644
--- a/tests/fsharpqa/Source/Warnings/env.lst
+++ b/tests/fsharpqa/Source/Warnings/env.lst
@@ -40,19 +40,8 @@
SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs
SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs
SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs
- SOURCE=WarnIfExpressionResultUnused.fs # WarnIfExpressionResultUnused.fs
SOURCE=MemberHasMultiplePossibleDispatchSlots.fs # MemberHasMultiplePossibleDispatchSlots.fs
SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs
- SOURCE=WarnIfPossibleAssignment.fs
- SOURCE=WarnIfPossibleAssignmentToMutable.fs
- SOURCE=WarnIfPossibleDotNetPropertySetter.fs
- SOURCE=DontWarnIfPropertyWithoutSetter.fs
- SOURCE=WarnIfImplicitlyDiscarded.fs
- SOURCE=WarnIfDiscardedInList.fs
- SOURCE=WarnIfDiscardedInList2.fs
- SOURCE=WarnIfDiscardedInList3.fs
- SOURCE=WarnOnlyOnLastExpression.fs
- SOURCE=WarnIfPossiblePropertySetter.fs
SOURCE=DoCannotHaveVisibilityDeclarations.fs
SOURCE=ModuleAbbreviationsArePrivate.fs
SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs
From 650805b36840bd9ded0d4472a31bc756a42e8243 Mon Sep 17 00:00:00 2001
From: Sean McLemon
Date: Wed, 17 Jul 2019 23:01:51 +0200
Subject: [PATCH 06/22] move some error and warning tests to NUnit (#7244)
* move some error and warning tests to NUnit
* CompilerAssert.ParseWithErrors now uses ParseFile instead of ParseAndCheckFileInProject
* merge conflicts
---
tests/fsharp/Compiler/CompilerAssert.fs | 19 +++
.../ErrorMessages/AssignmentErrorTests.fs | 23 ++++
.../Warnings/AssignmentWarningTests.fs | 108 ++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 2 +
.../E_GlobalQualifierAfterDot.fs | 6 -
.../ErrorMessages/NameResolution/env.lst | 1 -
.../Source/Warnings/AssignmentOnImmutable.fs | 7 --
tests/fsharpqa/Source/Warnings/env.lst | 1 -
tests/fsharpqa/Source/test.lst | 1 -
9 files changed, 152 insertions(+), 16 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs
create mode 100644 tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
delete mode 100644 tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs
diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs
index d5f93d7810e..ade3ca8e4a3 100644
--- a/tests/fsharp/Compiler/CompilerAssert.fs
+++ b/tests/fsharp/Compiler/CompilerAssert.fs
@@ -217,3 +217,22 @@ module CompilerAssert =
Assert.AreEqual(expectedErrorMessage, errorMessage)
)
+ let ParseWithErrors (source: string) expectedParseErrors =
+ let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously
+
+ Assert.True(parseResults.ParseHadErrors)
+
+ let errors =
+ parseResults.Errors
+ |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLineAlternate, e.StartColumn, e.EndLineAlternate, e.EndColumn, e.Message)
+
+ Assert.AreEqual(Array.length expectedParseErrors, errors.Length, sprintf "Type check errors: %A" parseResults.Errors)
+
+ Array.zip errors expectedParseErrors
+ |> Array.iter (fun (info, expectedError) ->
+ let (expectedServerity: FSharpErrorSeverity, expectedErrorNumber: int, expectedErrorRange: int * int * int * int, expectedErrorMsg: string) = expectedError
+ Assert.AreEqual(expectedServerity, info.Severity)
+ Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber")
+ Assert.AreEqual(expectedErrorRange, (info.StartLineAlternate, info.StartColumn + 1, info.EndLineAlternate, info.EndColumn + 1), "expectedErrorRange")
+ Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg")
+ )
\ No newline at end of file
diff --git a/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs b/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs
new file mode 100644
index 00000000000..51b75dd87d7
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs
@@ -0,0 +1,23 @@
+// 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 ``Errors assigning to mutable objects`` =
+
+ []
+ let ``Assign to immutable error``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = 10
+x <- 20
+
+exit 0
+ """
+ FSharpErrorSeverity.Error
+ 27
+ (3, 1, 3, 8)
+ "This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'."
\ No newline at end of file
diff --git a/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs
new file mode 100644
index 00000000000..2a0d15d8f8b
--- /dev/null
+++ b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs
@@ -0,0 +1,108 @@
+// 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 ``Warnings assigning to mutable and immutable objects`` =
+
+ []
+ let ``Unused compare with immutable when assignment might be intended``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = 10
+let y = "hello"
+
+let changeX() =
+ x = 20
+ y = "test"
+
+exit 0
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 11)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'."
+
+ []
+ let ``Unused compare with mutable when assignment might be intended``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let mutable x = 10
+let y = "hello"
+
+let changeX() =
+ x = 20
+ y = "test"
+
+exit 0
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (6, 5, 6, 11)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'."
+
+ []
+ let ``Unused comparison of property in dotnet object when assignment might be intended``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+open System
+
+let z = new System.Timers.Timer()
+let y = "hello"
+
+let changeProperty() =
+ z.Enabled = true
+ y = "test"
+
+exit 0
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (8, 5, 8, 21)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'."
+
+ []
+ let ``Unused comparison of property when assignment might be intended ``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type MyClass(property1 : int) =
+ member val Property1 = property1
+ member val Property2 = "" with get, set
+
+let x = MyClass(1)
+let y = "hello"
+
+let changeProperty() =
+ x.Property2 = "20"
+ y = "test"
+
+exit 0
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (10, 5, 10, 23)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'."
+
+ []
+ let ``Don't warn if assignment to property without setter ``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type MyClass(property1 : int) =
+ member val Property2 = "" with get
+
+let x = MyClass(1)
+let y = "hello"
+
+let changeProperty() =
+ x.Property2 = "22"
+ y = "test"
+
+exit 0
+ """
+ FSharpErrorSeverity.Warning
+ 20
+ (9, 5, 9, 23)
+ "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
\ No newline at end of file
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index b1bb4c1e33a..50e3e4f2d47 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -38,6 +38,7 @@
+
@@ -45,6 +46,7 @@
+
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
deleted file mode 100644
index 9bde0edbc4f..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs
+++ /dev/null
@@ -1,6 +0,0 @@
-// #ErrorMessages #NameResolution
-//'global' may only be used as the first name in a qualified path
-
-let x = global.System.String.Empty.global.System.String.Empty
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
deleted file mode 100644
index 71bc0eb3900..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
+++ /dev/null
@@ -1 +0,0 @@
-SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs b/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs
deleted file mode 100644
index a2e35c78a90..00000000000
--- a/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs
+++ /dev/null
@@ -1,7 +0,0 @@
-// #Warnings
-//This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'.
-
-let x = 10
-x <- 20
-
-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 9b5fbffaeba..a3d677bf0fc 100644
--- a/tests/fsharpqa/Source/Warnings/env.lst
+++ b/tests/fsharpqa/Source/Warnings/env.lst
@@ -32,7 +32,6 @@
SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs
SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs
SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs
- SOURCE=AssignmentOnImmutable.fs # AssignmentOnImmutable.fs
SOURCE=SuggestFieldsInCtor.fs # SuggestFieldsInCtor.fs
SOURCE=FieldSuggestion.fs # FieldSuggestion.fs
SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs
diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst
index f3d79d7a03f..147475acc7f 100644
--- a/tests/fsharpqa/Source/test.lst
+++ b/tests/fsharpqa/Source/test.lst
@@ -264,7 +264,6 @@ Misc01 Libraries\Core\Operators
Misc01 Libraries\Core\Reflection
Misc01 Libraries\Core\Unchecked
Misc01 Warnings
-Misc01 ErrorMessages\NameResolution
Misc01 ErrorMessages\UnitGenericAbstractType
Misc01 ErrorMessages\ConfusingTypeName
From 375fd7c63f29d74d18c30c285d726107d8af301f Mon Sep 17 00:00:00 2001
From: dotnet-maestro <@dotnet-maestro>
Date: Thu, 18 Jul 2019 12:51:28 +0000
Subject: [PATCH 07/22] Update dependencies from
https://github.com/dotnet/arcade build 20190717.8
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19367.8
---
eng/Version.Details.xml | 4 ++--
eng/common/init-tools-native.sh | 2 +-
.../templates/post-build/channels/internal-servicing.yml | 1 +
eng/common/templates/post-build/channels/public-release.yml | 1 +
eng/common/tools.ps1 | 2 +-
global.json | 2 +-
6 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 86d49308d4e..35196ac2a5f 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- 0dd5e2025f0049c133a8706f40e4463b193e5d17
+ 2359dc4184133defa27c8f3072622270b71b4ecf
diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh
index fc72d13948e..5f2e77f448b 100644
--- a/eng/common/init-tools-native.sh
+++ b/eng/common/init-tools-native.sh
@@ -71,7 +71,7 @@ function ReadGlobalJsonNativeTools {
local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}')
native_tools_list=${native_tools_list//[\" ]/}
native_tools_list=${native_tools_list//,/$'\n'}
- native_tools_list="$(echo -e "${native_tools_list}" | tr -d '[:space:]')"
+ native_tools_list="$(echo -e "${native_tools_list}" | tr -d '[[:space:]]')"
local old_IFS=$IFS
while read -r line; do
diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml
index 50ad724fc0c..648e854e0ed 100644
--- a/eng/common/templates/post-build/channels/internal-servicing.yml
+++ b/eng/common/templates/post-build/channels/internal-servicing.yml
@@ -84,6 +84,7 @@ stages:
/p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName)
/p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1)
/p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url)
+ /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url)
/p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe
/p:BARBuildId=$(BARBuildId)
/p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com'
diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml
index 574cb1c2b92..f6a7efdfe9d 100644
--- a/eng/common/templates/post-build/channels/public-release.yml
+++ b/eng/common/templates/post-build/channels/public-release.yml
@@ -84,6 +84,7 @@ stages:
/p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName)
/p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1)
/p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url)
+ /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url)
/p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe
/p:BARBuildId=$(BARBuildId)
/p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com'
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 9abaac015fb..8fe2b11ad21 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -169,7 +169,7 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
InstallDotNet $dotnetRoot $version $architecture
}
-function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { $installScript = GetDotNetInstallScript $dotnetRoot
+function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) {
$installScript = GetDotNetInstallScript $dotnetRoot
$installParameters = @{
Version = $version
diff --git a/global.json b/global.json
index 7d6048be9fe..b4297bf622c 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19366.4",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19367.8",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From c423de9078db600cb0b95f48a518823417217b91 Mon Sep 17 00:00:00 2001
From: Faisal Alfaddaghi
Date: Fri, 19 Jul 2019 20:36:19 +0300
Subject: [PATCH 08/22] Move UnitGenericAbstractType To Nunit (#7257)
---
.../ErrorMessages/UnitGenericAbstactType.fs | 27 +++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 1 +
.../E_UnitGenericAbstractType1.fs | 9 -------
.../UnitGenericAbstractType/env.lst | 1 -
4 files changed, 28 insertions(+), 10 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs
delete mode 100644 tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst
diff --git a/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs
new file mode 100644
index 00000000000..e9165a4cf6a
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs
@@ -0,0 +1,27 @@
+// 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 ``Unit generic abstract Type`` =
+
+ []
+ let ``Unit can not be used as return type of abstract method paramete on return type``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type EDF<'S> =
+ abstract member Apply : int -> 'S
+type SomeEDF () =
+ interface EDF with
+ member this.Apply d =
+ // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method.
+ ()
+ """
+ FSharpErrorSeverity.Error
+ 17
+ (6, 21, 6, 26)
+ "The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type."
+
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index 50e3e4f2d47..0c9578f2192 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -36,6 +36,7 @@
+
diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs
deleted file mode 100644
index 0b7f1d98a6d..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #ErrorMessages #UnitGenericAbstractType
-//The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type\.
-type EDF<'S> =
- abstract member Apply : int -> 'S
-type SomeEDF () =
- interface EDF with
- member this.Apply d =
- // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method.
- ()
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst
deleted file mode 100644
index 26ae602bd6a..00000000000
--- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst
+++ /dev/null
@@ -1 +0,0 @@
- SOURCE=E_UnitGenericAbstractType1.fs # E_UnitGenericAbstractType1
\ No newline at end of file
From 4151eb23b521f74e3ec1292779c8ab47a9d8014a Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Fri, 19 Jul 2019 10:38:48 -0700
Subject: [PATCH 09/22] Update dependencies from
https://github.com/dotnet/arcade build 20190718.7 (#7256)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19368.7
---
eng/Version.Details.xml | 4 +-
eng/common/pipeline-logging-functions.sh | 82 ++++++++++++++++++++++--
eng/common/tools.sh | 19 +++---
global.json | 2 +-
4 files changed, 87 insertions(+), 20 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 35196ac2a5f..7a60463a0fb 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- 2359dc4184133defa27c8f3072622270b71b4ecf
+ eecde8a8751dbe7fdb17ba4dfbd032e26f4cae7d
diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh
index 6098f9a5438..1c560a50613 100644
--- a/eng/common/pipeline-logging-functions.sh
+++ b/eng/common/pipeline-logging-functions.sh
@@ -39,11 +39,11 @@ function Write-PipelineTaskError {
return
fi
- message_type="error"
- sourcepath=''
- linenumber=''
- columnnumber=''
- error_code=''
+ local message_type="error"
+ local sourcepath=''
+ local linenumber=''
+ local columnnumber=''
+ local error_code=''
while [[ $# -gt 0 ]]; do
opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
@@ -76,7 +76,7 @@ function Write-PipelineTaskError {
shift
done
- message="##vso[task.logissue"
+ local message="##vso[task.logissue"
message="$message type=$message_type"
@@ -100,3 +100,73 @@ function Write-PipelineTaskError {
echo "$message"
}
+function Write-PipelineSetVariable {
+ if [[ "$ci" != true ]]; then
+ return
+ fi
+
+ local name=''
+ local value=''
+ local secret=false
+ local as_output=false
+ local is_multi_job_variable=true
+
+ while [[ $# -gt 0 ]]; do
+ opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
+ case "$opt" in
+ -name|-n)
+ name=$2
+ shift
+ ;;
+ -value|-v)
+ value=$2
+ shift
+ ;;
+ -secret|-s)
+ secret=true
+ ;;
+ -as_output|-a)
+ as_output=true
+ ;;
+ -is_multi_job_variable|-i)
+ is_multi_job_variable=$2
+ shift
+ ;;
+ esac
+ shift
+ done
+
+ value=${value/;/%3B}
+ value=${value/\\r/%0D}
+ value=${value/\\n/%0A}
+ value=${value/]/%5D}
+
+ local message="##vso[task.setvariable variable=$name;isSecret=$secret;isOutput=$is_multi_job_variable]$value"
+
+ if [[ "$as_output" == true ]]; then
+ $message
+ else
+ echo "$message"
+ fi
+}
+
+function Write-PipelinePrependPath {
+ local prepend_path=''
+
+ while [[ $# -gt 0 ]]; do
+ opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
+ case "$opt" in
+ -path|-p)
+ prepend_path=$2
+ shift
+ ;;
+ esac
+ shift
+ done
+
+ export PATH="$prepend_path:$PATH"
+
+ if [[ "$ci" == true ]]; then
+ echo "##vso[task.prependpath]$prepend_path"
+ fi
+}
\ No newline at end of file
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index 70d92cf85aa..0deb01c480b 100644
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -146,14 +146,10 @@ function InitializeDotNetCli {
# Add dotnet to PATH. This prevents any bare invocation of dotnet in custom
# build steps from using anything other than what we've downloaded.
- export PATH="$dotnet_root:$PATH"
+ Write-PipelinePrependPath -path "$dotnet_root"
- if [[ $ci == true ]]; then
- # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build
- echo "##vso[task.prependpath]$dotnet_root"
- echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0"
- echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1"
- fi
+ Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0"
+ Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1"
# return value
_InitializeDotNetCli="$dotnet_root"
@@ -387,7 +383,8 @@ mkdir -p "$toolset_dir"
mkdir -p "$temp_dir"
mkdir -p "$log_dir"
-if [[ $ci == true ]]; then
- export TEMP="$temp_dir"
- export TMP="$temp_dir"
-fi
+Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir"
+Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir"
+Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir"
+Write-PipelineSetVariable -name "Temp" -value "$temp_dir"
+Write-PipelineSetVariable -name "TMP" -value "$temp_dir"
diff --git a/global.json b/global.json
index b4297bf622c..78425fae2ed 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19367.8",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19368.7",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From bdb2b79e06bcb1b515ba4243103a9ff3cfbb2ea2 Mon Sep 17 00:00:00 2001
From: Sergey Tihon
Date: Fri, 19 Jul 2019 21:02:07 +0300
Subject: [PATCH 10/22] Moving TypeMismatchTests over to NUnit (#7250)
* Moving TypeMismatchTests over to NUnit
* ci restart
---
.../ErrorMessages/TypeMismatchTests.fs | 135 ++++++++++++++++++
tests/fsharp/FSharpSuite.Tests.fsproj | 1 +
.../Source/Warnings/GuardHasWrongType.fs | 9 --
.../Source/Warnings/OverrideErrors.fs | 22 ---
.../Source/Warnings/RefCellInsteadOfNot.fs | 9 --
.../Source/Warnings/RefCellInsteadOfNot2.fs | 8 --
.../Warnings/ReturnInsteadOfReturnBang.fs | 10 --
.../Warnings/RuntimeTypeTestInPattern.fs | 13 --
.../Warnings/RuntimeTypeTestInPattern2.fs | 13 --
.../Warnings/YieldInsteadOfYieldBang.fs | 13 --
tests/fsharpqa/Source/Warnings/env.lst | 8 --
11 files changed, 136 insertions(+), 105 deletions(-)
create mode 100644 tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/OverrideErrors.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs
delete mode 100644 tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs
diff --git a/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs b/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs
new file mode 100644
index 00000000000..652361045c9
--- /dev/null
+++ b/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs
@@ -0,0 +1,135 @@
+// 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 ``Type Mismatch`` =
+
+ []
+ let ``return Instead Of return!``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let rec foo() = async { return foo() }
+ """
+ FSharpErrorSeverity.Error
+ 1
+ (2, 32, 2, 37)
+ "Type mismatch. Expecting a\n ''a' \nbut given a\n 'Async<'a>' \nThe types ''a' and 'Async<'a>' cannot be unified. Consider using 'return!' instead of 'return'."
+
+ []
+ let ``yield Instead Of yield!``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+type Foo() =
+ member this.Yield(x) = [x]
+
+let rec f () = Foo() { yield f ()}
+ """
+ FSharpErrorSeverity.Error
+ 1
+ (5, 30, 5, 34)
+ "Type mismatch. Expecting a\n ''a' \nbut given a\n ''a list' \nThe types ''a' and ''a list' cannot be unified. Consider using 'yield!' instead of 'yield'."
+
+ []
+ let ``Ref Cell Instead Of Not``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = true
+if !x then
+ printfn "hello"
+ """
+ FSharpErrorSeverity.Error
+ 1
+ (3, 5, 3, 6)
+ "This expression was expected to have type\n 'bool ref' \nbut here has type\n 'bool' \r\nThe '!' operator is used to dereference a ref cell. Consider using 'not expr' here."
+
+ []
+ let ``Ref Cell Instead Of Not 2``() =
+ CompilerAssert.TypeCheckSingleError
+ """
+let x = true
+let y = !x
+ """
+ FSharpErrorSeverity.Error
+ 1
+ (3, 10, 3, 11)
+ "This expression was expected to have type\n ''a ref' \nbut here has type\n 'bool' \r\nThe '!' operator is used to dereference a ref cell. Consider using 'not expr' here."
+
+ []
+ let ``Guard Has Wrong Type``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+let x = 1
+match x with
+| 1 when "s" -> true
+| _ -> false
+ """
+ [|
+ FSharpErrorSeverity.Error, 1, (4, 10, 4, 13), "A pattern match guard must be of type 'bool', but this 'when' expression is of type 'string'."
+ FSharpErrorSeverity.Warning, 20, (3, 1, 5, 13), "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+ |]
+
+ []
+ let ``Runtime Type Test In Pattern``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+open System.Collections.Generic
+
+let orig = Dictionary()
+
+let c =
+ match orig with
+ | :? IDictionary -> "yes"
+ | _ -> "no"
+ """
+ [|
+ FSharpErrorSeverity.Warning, 67, (8, 5, 8, 28), "This type test or downcast will always hold"
+ FSharpErrorSeverity.Error, 193, (8, 5, 8, 28), "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n"
+ |]
+
+ []
+ let ``Runtime Type Test In Pattern 2``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+open System.Collections.Generic
+
+let orig = Dictionary()
+
+let c =
+ match orig with
+ | :? IDictionary as y -> "yes" + y.ToString()
+ | _ -> "no"
+ """
+ [|
+ FSharpErrorSeverity.Warning, 67, (8, 5, 8, 28), "This type test or downcast will always hold"
+ FSharpErrorSeverity.Error, 193, (8, 5, 8, 28), "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n"
+ |]
+
+ []
+ let ``Override Errors``() =
+ CompilerAssert.TypeCheckWithErrors
+ """
+type Base() =
+ abstract member Member: int * string -> string
+ default x.Member (i, s) = s
+
+type Derived1() =
+ inherit Base()
+ override x.Member() = 5
+
+type Derived2() =
+ inherit Base()
+ override x.Member (i : int) = "Hello"
+
+type Derived3() =
+ inherit Base()
+ override x.Member (s : string, i : int) = sprintf "Hello %s" s
+ """
+ [|
+ FSharpErrorSeverity.Error, 856, (8, 16, 8, 22), "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:\r\n abstract member Base.Member : int * string -> string"
+ FSharpErrorSeverity.Error, 856, (12, 16, 12, 22), "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:\r\n abstract member Base.Member : int * string -> string"
+ FSharpErrorSeverity.Error, 1, (16, 24, 16, 34), "This expression was expected to have type\n 'int' \nbut here has type\n 'string' "
+ |]
diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj
index 0c9578f2192..9d80400c401 100644
--- a/tests/fsharp/FSharpSuite.Tests.fsproj
+++ b/tests/fsharp/FSharpSuite.Tests.fsproj
@@ -38,6 +38,7 @@
+
diff --git a/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs b/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs
deleted file mode 100644
index ac0c3cb4f3c..00000000000
--- a/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #Warnings
-//A pattern match guard must be of type 'bool'
-
-let x = 1
-match x with
-| 1 when "s" -> true
-| _ -> false
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/OverrideErrors.fs b/tests/fsharpqa/Source/Warnings/OverrideErrors.fs
deleted file mode 100644
index ff03ba6ed4e..00000000000
--- a/tests/fsharpqa/Source/Warnings/OverrideErrors.fs
+++ /dev/null
@@ -1,22 +0,0 @@
-// #Warnings
-//This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:
-//abstract member Base.Member : int * string -> string
-//This expression was expected to have type
-
-type Base() =
- abstract member Member: int * string -> string
- default x.Member (i, s) = s
-
-type Derived1() =
- inherit Base()
- override x.Member() = 5
-
-type Derived2() =
- inherit Base()
- override x.Member (i : int) = "Hello"
-
-type Derived3() =
- inherit Base()
- override x.Member (s : string, i : int) = sprintf "Hello %s" s
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs
deleted file mode 100644
index 1c6987bfa63..00000000000
--- a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs
+++ /dev/null
@@ -1,9 +0,0 @@
-// #Warnings
-//This expression was expected to have type
-//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here.
-
-let x = true
-if !x then
- printfn "hello"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs
deleted file mode 100644
index 090934d8f56..00000000000
--- a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs
+++ /dev/null
@@ -1,8 +0,0 @@
-// #Warnings
-//This expression was expected to have type
-//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here.
-
-let x = true
-let y = !x
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs b/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs
deleted file mode 100644
index d9f87c521bd..00000000000
--- a/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs
+++ /dev/null
@@ -1,10 +0,0 @@
-// #Warnings
-//Type mismatch. Expecting a
-//''a'
-//but given a
-//'Async<'a>'
-//The types ''a' and 'Async<'a>' cannot be unified. Consider using 'return!' instead of 'return'.
-
-let rec foo() = async { return foo() }
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs b/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs
deleted file mode 100644
index 67ae796376d..00000000000
--- a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Warnings
-//Type constraint mismatch. The type
-
-open System.Collections.Generic
-
-let orig = Dictionary()
-
-let c =
- match orig with
- | :? IDictionary -> "yes"
- | _ -> "no"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs b/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs
deleted file mode 100644
index 098969482c5..00000000000
--- a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Warnings
-//Type constraint mismatch. The type
-
-open System.Collections.Generic
-
-let orig = Dictionary()
-
-let c =
- match orig with
- | :? IDictionary as y -> "yes" + y.ToString()
- | _ -> "no"
-
-exit 0
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs b/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs
deleted file mode 100644
index bd547fa7b28..00000000000
--- a/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Warnings
-//Type mismatch. Expecting a
-//''a'
-//but given a
-//''a list'
-//The types ''a' and ''a list' cannot be unified. Consider using 'yield!' instead of 'yield'.
-
-type Foo() =
- member this.Yield(x) = [x]
-
-let rec f () = Foo() { yield f ()}
-
-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 a3d677bf0fc..18ef811a2a5 100644
--- a/tests/fsharpqa/Source/Warnings/env.lst
+++ b/tests/fsharpqa/Source/Warnings/env.lst
@@ -1,10 +1,7 @@
SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs
- SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs
- SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs
SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs
SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs
SOURCE=WrongArity.fs # WrongArity.fs
- SOURCE=OverrideErrors.fs # OverrideErrors.fs
SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs
SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs
SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs
@@ -28,17 +25,12 @@
SOURCE=DontSuggestWhenThingsAreOpen.fs SCFLAGS="--vserrors" # DontSuggestWhenThingsAreOpen.fs
SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs
SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs
- SOURCE=GuardHasWrongType.fs # GuardHasWrongType.fs
SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs
SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs
SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs
SOURCE=SuggestFieldsInCtor.fs # SuggestFieldsInCtor.fs
SOURCE=FieldSuggestion.fs # FieldSuggestion.fs
SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs
- SOURCE=RefCellInsteadOfNot.fs # RefCellInsteadOfNot.fs
- SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs
- SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs
- SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs
SOURCE=MemberHasMultiplePossibleDispatchSlots.fs # MemberHasMultiplePossibleDispatchSlots.fs
SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs
SOURCE=DoCannotHaveVisibilityDeclarations.fs
From b0e59263c73f5194c514ec36d48b861527e7d65b Mon Sep 17 00:00:00 2001
From: "Brett V. Forsgren"
Date: Fri, 19 Jul 2019 14:44:36 -0700
Subject: [PATCH 11/22] publish pdbs in FSharp.Core.nupkg (#7255)
Also publish native symbols so they can be archived later.
---
.vsts-signed.yaml | 8 ++++++++
azure-pipelines.yml | 6 ++++++
src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec | 2 ++
3 files changed, 16 insertions(+)
diff --git a/.vsts-signed.yaml b/.vsts-signed.yaml
index 3ec301bbe0c..ed30cb74ef2 100644
--- a/.vsts-signed.yaml
+++ b/.vsts-signed.yaml
@@ -105,6 +105,14 @@ jobs:
continueOnError: true
condition: succeeded()
+ # Publish native PDBs for archiving
+ - task: PublishBuildArtifacts@1
+ displayName: Publish Artifact Symbols
+ inputs:
+ PathtoPublish: '$(Build.SourcesDirectory)/artifacts/SymStore/$(BuildConfiguration)'
+ ArtifactName: NativeSymbols
+ condition: succeeded()
+
# Execute cleanup tasks
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Execute cleanup tasks
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 2207a4792eb..87306e5c604 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -113,6 +113,12 @@ jobs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(_BuildConfig)\VisualFSharpFull.vsix'
ArtifactName: 'Nightly'
condition: succeeded()
+ - task: PublishBuildArtifacts@1
+ displayName: Publish Artifact Symbols
+ inputs:
+ PathtoPublish: '$(Build.SourcesDirectory)\artifacts\SymStore\$(_BuildConfig)'
+ ArtifactName: 'NativeSymbols'
+ condition: succeeded()
#---------------------------------------------------------------------------------------------------------------------#
# PR builds #
diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
index ee7a88b29d6..750052c45db 100644
--- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
+++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
@@ -38,11 +38,13 @@
+
+
From 3e7b66dcd0bb58c575eda182a0aee24819577942 Mon Sep 17 00:00:00 2001
From: "Kevin Ransom (msft)"
Date: Fri, 19 Jul 2019 20:17:49 -0700
Subject: [PATCH 12/22] Enable hash algorithm selection (#7252)
* Enable hash algorithm selection
* Feedback
* More feedback
* Revert "Feedback"
This reverts commit 6ab1b077b413712f552bad9b2562aeb63994ad4c.
* feedback
---
src/absil/ilwrite.fs | 127 ++++++++++-------
src/absil/ilwrite.fsi | 10 +-
src/absil/ilwritepdb.fs | 129 ++++++++++++------
src/absil/ilwritepdb.fsi | 12 +-
src/fsharp/CompileOps.fs | 4 +
src/fsharp/CompileOps.fsi | 3 +
src/fsharp/CompileOptions.fs | 12 ++
src/fsharp/FSComp.txt | 2 +
src/fsharp/FSharp.Build/Fsc.fs | 15 +-
.../FSharp.Build/Microsoft.FSharp.Targets | 1 +
.../FSharp.Compiler.Private.fsproj | 6 +-
src/fsharp/fsc.fs | 1 +
src/fsharp/xlf/FSComp.txt.cs.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.de.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.es.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.fr.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.it.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.ja.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.ko.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.pl.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.ru.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.tr.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 10 ++
src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 10 ++
.../ProvidedTypes/ProvidedTypes.fs | 2 +-
tests/fsharp/.gitignore | 3 +-
.../fsc/dumpAllCommandLineOptions/dummy.fs | 1 +
.../fsc/help/help40.437.1033.bsl | 4 +
29 files changed, 359 insertions(+), 103 deletions(-)
diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs
index 5d6bfd3ee06..66d2dd9a667 100644
--- a/src/absil/ilwrite.fs
+++ b/src/absil/ilwrite.fs
@@ -3025,7 +3025,8 @@ let generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg : IL
//=====================================================================
// TABLES+BLOBS --> PHYSICAL METADATA+BLOBS
//=====================================================================
-let chunk sz next = ({addr=next; size=sz}, next + sz)
+let chunk sz next = ({addr=next; size=sz}, next + sz)
+let emptychunk next = ({addr=next; size=0}, next)
let nochunk next = ({addr= 0x0;size= 0x0; }, next)
let count f arr =
@@ -3516,7 +3517,7 @@ let writeBytes (os: BinaryWriter) (chunk: byte[]) = os.Write(chunk, 0, chunk.Len
let writeBinaryAndReportMappings (outfile,
ilg: ILGlobals, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB, embeddedPDB,
- embedAllSource, embedSourceList, sourceLink, emitTailcalls, deterministic, showTimes, dumpDebugInfo, pathMap)
+ embedAllSource, embedSourceList, sourceLink, checksumAlgorithm, emitTailcalls, deterministic, showTimes, dumpDebugInfo, pathMap)
modul normalizeAssemblyRefs =
// Store the public key from the signer into the manifest. This means it will be written
// to the binary and also acts as an indicator to leave space for delay sign
@@ -3565,7 +3566,7 @@ let writeBinaryAndReportMappings (outfile,
with e ->
failwith ("Could not open file for writing (binary mode): " + outfile)
- let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings =
+ let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings =
try
let imageBaseReal = modul.ImageBase // FIXED CHOICE
@@ -3670,42 +3671,61 @@ let writeBinaryAndReportMappings (outfile,
let pdbOpt =
match portablePDB with
| true ->
- let (uncompressedLength, contentId, stream) as pdbStream =
- generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData deterministic pathMap
+ let (uncompressedLength, contentId, stream, algorithmName, checkSum) as pdbStream =
+ generatePortablePdb embedAllSource embedSourceList sourceLink checksumAlgorithm showTimes pdbData pathMap
- if embeddedPDB then Some (compressPortablePdbStream uncompressedLength contentId stream)
+ if embeddedPDB then
+ let uncompressedLength, contentId, stream = compressPortablePdbStream uncompressedLength contentId stream
+ Some (uncompressedLength, contentId, stream, algorithmName, checkSum)
else Some pdbStream
| _ -> None
- let debugDirectoryChunk, next =
- chunk (if pdbfile = None then
- 0x0
- else if embeddedPDB && portablePDB then
- sizeof_IMAGE_DEBUG_DIRECTORY * 2
+ let debugDirectoryChunk, next =
+ chunk (if pdbfile = None then
+ 0x0
else
- sizeof_IMAGE_DEBUG_DIRECTORY
+ sizeof_IMAGE_DEBUG_DIRECTORY * 2 +
+ (if embeddedPDB then sizeof_IMAGE_DEBUG_DIRECTORY else 0) +
+ (if deterministic then sizeof_IMAGE_DEBUG_DIRECTORY else 0)
) next
+
// The debug data is given to us by the PDB writer and appears to
// typically be the type of the data plus the PDB file name. We fill
// this in after we've written the binary. We approximate the size according
// to what PDB writers seem to require and leave extra space just in case...
let debugDataJustInCase = 40
- let debugDataChunk, next =
+ let debugDataChunk, next =
chunk (align 0x4 (match pdbfile with
| None -> 0
| Some f -> (24
+ System.Text.Encoding.Unicode.GetByteCount f // See bug 748444
+ debugDataJustInCase))) next
- let debugEmbeddedPdbChunk, next =
- let streamLength =
- match pdbOpt with
- | Some (_, _, stream) -> int stream.Length
- | None -> 0
- chunk (align 0x4 (match embeddedPDB with
- | true -> 8 + streamLength
- | _ -> 0 )) next
+ let debugChecksumPdbChunk, next =
+ chunk (align 0x4 (match pdbOpt with
+ | Some (_, _, _, algorithmName, checkSum) ->
+ let alg = System.Text.Encoding.UTF8.GetBytes(algorithmName)
+ let size = alg.Length + 1 + checkSum.Length
+ size
+ | None -> 0)) next
+
+ let debugEmbeddedPdbChunk, next =
+ if embeddedPDB then
+ let streamLength =
+ match pdbOpt with
+ | Some (_, _, stream, _, _) -> int stream.Length
+ | None -> 0
+ chunk (align 0x4 (match embeddedPDB with
+ | true -> 8 + streamLength
+ | _ -> 0 )) next
+ else
+ nochunk next
+
+ let debugDeterministicPdbChunk, next =
+ if deterministic then emptychunk next
+ else nochunk next
+
let textSectionSize = next - textSectionAddr
let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize)
@@ -3804,35 +3824,39 @@ let writeBinaryAndReportMappings (outfile,
if pCurrent <> pExpected then
failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected)
writeBytes os chunk
-
+
let writePadding (os: BinaryWriter) _comment sz =
if sz < 0 then failwith "writePadding: size < 0"
for i = 0 to sz - 1 do
os.Write 0uy
-
+
// Now we've computed all the offsets, write the image
-
+
write (Some msdosHeaderChunk.addr) os "msdos header" msdosHeader
-
+
write (Some peSignatureChunk.addr) os "pe signature" [| |]
-
+
writeInt32 os 0x4550
-
+
write (Some peFileHeaderChunk.addr) os "pe file header" [| |]
-
+
if (modul.Platform = Some AMD64) then
writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64
elif isItanium then
writeInt32AsUInt16 os 0x200
else
writeInt32AsUInt16 os 0x014c // Machine - IMAGE_FILE_MACHINE_I386
-
+
writeInt32AsUInt16 os numSections
- let pdbData =
+ let pdbData =
+ // Hash code, data and metadata
if deterministic then
- // Hash code, data and metadata
- use sha = System.Security.Cryptography.SHA1.Create() // IncrementalHash is core only
+ use sha =
+ match checksumAlgorithm with
+ | HashAlgorithm.Sha1 -> System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm
+ | HashAlgorithm.Sha256 -> System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm
+
let hCode = sha.ComputeHash code
let hData = sha.ComputeHash data
let hMeta = sha.ComputeHash metadata
@@ -3848,6 +3872,7 @@ let writeBinaryAndReportMappings (outfile,
// Use last 4 bytes for timestamp - High bit set, to stop tool chains becoming confused
let timestamp = int final.[16] ||| (int final.[17] <<< 8) ||| (int final.[18] <<< 16) ||| (int (final.[19] ||| 128uy) <<< 24)
writeInt32 os timestamp
+
// Update pdbData with new guid and timestamp. Portable and embedded PDBs don't need the ModuleID
// Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-determinsitic Windows native code
{ pdbData with ModuleID = final.[0..15] ; Timestamp = timestamp }
@@ -4133,10 +4158,14 @@ let writeBinaryAndReportMappings (outfile,
if pdbfile.IsSome then
write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy)
write (Some (textV2P debugDataChunk.addr)) os "debug data" (Array.create debugDataChunk.size 0x0uy)
+ write (Some (textV2P debugChecksumPdbChunk.addr)) os "debug checksum" (Array.create debugChecksumPdbChunk.size 0x0uy)
if embeddedPDB then
write (Some (textV2P debugEmbeddedPdbChunk.addr)) os "debug data" (Array.create debugEmbeddedPdbChunk.size 0x0uy)
+ if deterministic then
+ write (Some (textV2P debugDeterministicPdbChunk.addr)) os "debug deterministic" Array.empty
+
writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize)
// DATA SECTION
@@ -4182,7 +4211,7 @@ let writeBinaryAndReportMappings (outfile,
FileSystemUtilites.setExecutablePermission outfile
with _ ->
()
- pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings
+ pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings
// Looks like a finally
with e ->
@@ -4207,11 +4236,11 @@ let writeBinaryAndReportMappings (outfile,
try
let idd =
match pdbOpt with
- | Some (originalLength, contentId, stream) ->
+ | Some (originalLength, contentId, stream, algorithmName, checkSum) ->
if embeddedPDB then
- embedPortablePdbInfo originalLength contentId stream showTimes fpdb debugDataChunk debugEmbeddedPdbChunk
+ embedPortablePdbInfo originalLength contentId stream showTimes fpdb debugDataChunk debugEmbeddedPdbChunk debugDeterministicPdbChunk debugChecksumPdbChunk algorithmName checkSum embeddedPDB deterministic
else
- writePortablePdbInfo contentId stream showTimes fpdb pathMap debugDataChunk
+ writePortablePdbInfo contentId stream showTimes fpdb pathMap debugDataChunk debugDeterministicPdbChunk debugChecksumPdbChunk algorithmName checkSum embeddedPDB deterministic
| None ->
#if FX_NO_PDB_WRITER
Array.empty
@@ -4232,16 +4261,17 @@ let writeBinaryAndReportMappings (outfile,
writeInt32AsUInt16 os2 i.iddMajorVersion
writeInt32AsUInt16 os2 i.iddMinorVersion
writeInt32 os2 i.iddType
- writeInt32 os2 i.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData
- writeInt32 os2 i.iddChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData
- writeInt32 os2 (textV2P i.iddChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData
+ writeInt32 os2 i.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData
+ writeInt32 os2 i.iddChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData
+ writeInt32 os2 (textV2P i.iddChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData
// Write the Debug Data
for i in idd do
- // write the debug raw data as given us by the PDB writer
- os2.BaseStream.Seek (int64 (textV2P i.iddChunk.addr), SeekOrigin.Begin) |> ignore
- if i.iddChunk.size < i.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable"
- writeBytes os2 i.iddData
+ if i.iddChunk.size <> 0 then
+ // write the debug raw data as given us by the PDB writer
+ os2.BaseStream.Seek (int64 (textV2P i.iddChunk.addr), SeekOrigin.Begin) |> ignore
+ if i.iddChunk.size < i.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable"
+ writeBytes os2 i.iddData
os2.Dispose()
with e ->
failwith ("Error while writing debug directory entry: "+e.Message)
@@ -4250,9 +4280,7 @@ let writeBinaryAndReportMappings (outfile,
with e ->
reraise()
- end
- ignore debugDataChunk
- ignore debugEmbeddedPdbChunk
+ end
reportTime showTimes "Finalize PDB"
/// Sign the binary. No further changes to binary allowed past this point!
@@ -4280,9 +4308,10 @@ type options =
embedAllSource: bool
embedSourceList: string list
sourceLink: string
+ checksumAlgorithm: HashAlgorithm
signer: ILStrongNameSigner option
- emitTailcalls : bool
- deterministic : bool
+ emitTailcalls: bool
+ deterministic: bool
showTimes: bool
dumpDebugInfo: bool
pathMap: PathMap }
@@ -4290,5 +4319,5 @@ type options =
let WriteILBinary (outfile, (args: options), modul, normalizeAssemblyRefs) =
writeBinaryAndReportMappings (outfile,
args.ilg, args.pdbfile, args.signer, args.portablePDB, args.embeddedPDB, args.embedAllSource,
- args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo, args.pathMap) modul normalizeAssemblyRefs
+ args.embedSourceList, args.sourceLink, args.checksumAlgorithm, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo, args.pathMap) modul normalizeAssemblyRefs
|> ignore
diff --git a/src/absil/ilwrite.fsi b/src/absil/ilwrite.fsi
index f1955f82a20..9dba89c9b6c 100644
--- a/src/absil/ilwrite.fsi
+++ b/src/absil/ilwrite.fsi
@@ -1,12 +1,13 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
/// The IL Binary writer.
-module internal FSharp.Compiler.AbstractIL.ILBinaryWriter
+module internal FSharp.Compiler.AbstractIL.ILBinaryWriter
open Internal.Utilities
-open FSharp.Compiler.AbstractIL
-open FSharp.Compiler.AbstractIL.Internal
-open FSharp.Compiler.AbstractIL.IL
+open FSharp.Compiler.AbstractIL
+open FSharp.Compiler.AbstractIL.Internal
+open FSharp.Compiler.AbstractIL.IL
+open FSharp.Compiler.AbstractIL.ILPdbWriter
[]
type ILStrongNameSigner =
@@ -24,6 +25,7 @@ type options =
embedAllSource: bool
embedSourceList: string list
sourceLink: string
+ checksumAlgorithm: HashAlgorithm
signer : ILStrongNameSigner option
emitTailcalls: bool
deterministic: bool
diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs
index 2a992ed4855..c1ffd692249 100644
--- a/src/absil/ilwritepdb.fs
+++ b/src/absil/ilwritepdb.fs
@@ -11,8 +11,9 @@ open System.Reflection
open System.Reflection.Metadata
open System.Reflection.Metadata.Ecma335
open System.Reflection.PortableExecutable
+open System.Text
open Internal.Utilities
-open FSharp.Compiler.AbstractIL.IL
+open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.Diagnostics
open FSharp.Compiler.AbstractIL.Internal.Support
open FSharp.Compiler.AbstractIL.Internal.Library
@@ -125,6 +126,27 @@ type idd =
iddData: byte[]
iddChunk: BinaryChunk }
+/// The specified Hash algorithm to use on portable pdb files.
+type HashAlgorithm =
+ | Sha1
+ | Sha256
+
+// Document checksum algorithms
+let guidSha1 = Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460")
+let guidSha2 = Guid("8829d00f-11b8-4213-878b-770e8597ac16")
+
+let checkSum (url: string) (checksumAlgorithm: HashAlgorithm) =
+ try
+ use file = FileSystem.FileStreamReadShim url
+ let guid, alg =
+ match checksumAlgorithm with
+ | HashAlgorithm.Sha1 -> guidSha1, System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm
+ | HashAlgorithm.Sha256 -> guidSha2, System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm
+
+ let checkSum = alg.ComputeHash file
+ Some (guid, checkSum)
+ with _ -> None
+
//---------------------------------------------------------------------
// Portable PDB Writer
//---------------------------------------------------------------------
@@ -153,7 +175,7 @@ let pdbGetCvDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvCh
}
let pdbMagicNumber= 0x4244504dL
-let pdbGetPdbDebugInfo (embeddedPDBChunk: BinaryChunk) (uncompressedLength: int64) (stream: MemoryStream) =
+let pdbGetEmbeddedPdbDebugInfo (embeddedPdbChunk: BinaryChunk) (uncompressedLength: int64) (stream: MemoryStream) =
let iddPdbBuffer =
let buffer = Array.zeroCreate (sizeof + sizeof + int(stream.Length))
let (offset, size) = (0, sizeof) // Magic Number dword: 0x4244504dL
@@ -169,28 +191,52 @@ let pdbGetPdbDebugInfo (embeddedPDBChunk: BinaryChunk) (uncompressedLength: int6
iddType = 17 // IMAGE_DEBUG_TYPE_EMBEDDEDPDB
iddTimestamp = 0
iddData = iddPdbBuffer // Path name to the pdb file when built
- iddChunk = embeddedPDBChunk
+ iddChunk = embeddedPdbChunk
}
-let pdbGetDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvChunk: BinaryChunk) (embeddedPDBChunk: BinaryChunk option) (uncompressedLength: int64) (stream: MemoryStream option) =
- match stream, embeddedPDBChunk with
- | None, _ | _, None -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk |]
- | Some s, Some chunk -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk; pdbGetPdbDebugInfo chunk uncompressedLength s |]
+let pdbChecksumDebugInfo timestamp (checksumPdbChunk: BinaryChunk) (algorithmName:string) (checksum: byte[]) =
+ let iddBuffer =
+ let alg = Encoding.UTF8.GetBytes(algorithmName)
+ let buffer = Array.zeroCreate (alg.Length + 1 + checksum.Length)
+ Buffer.BlockCopy(alg, 0, buffer, 0, alg.Length)
+ Buffer.BlockCopy(checksum, 0, buffer, alg.Length + 1, checksum.Length)
+ buffer
+ { iddCharacteristics = 0 // Reserved
+ iddMajorVersion = 1 // VersionMajor should be 1
+ iddMinorVersion = 0x0100 // VersionMinor should be 0x0100
+ iddType = 19 // IMAGE_DEBUG_TYPE_CHECKSUMPDB
+ iddTimestamp = timestamp
+ iddData = iddBuffer // Path name to the pdb file when built
+ iddChunk = checksumPdbChunk
+ }
-// Document checksum algorithms
-let guidSourceHashMD5 = System.Guid(0x406ea660u, 0x64cfus, 0x4c82us, 0xb6uy, 0xf0uy, 0x42uy, 0xd4uy, 0x81uy, 0x72uy, 0xa7uy, 0x99uy) //406ea660-64cf-4c82-b6f0-42d48172a799
-let hashSizeOfMD5 = 16
+let pdbGetPdbDebugDeterministicInfo (deterministicPdbChunk: BinaryChunk) =
+ { iddCharacteristics = 0 // Reserved
+ iddMajorVersion = 0 // VersionMajor should be 0
+ iddMinorVersion = 0 // VersionMinor should be 00
+ iddType = 16 // IMAGE_DEBUG_TYPE_DETERMINISTIC
+ iddTimestamp = 0
+ iddData = Array.empty // No DATA
+ iddChunk = deterministicPdbChunk
+ }
-// If the FIPS algorithm policy is enabled on the computer (e.g., for US government employees and contractors)
-// then obtaining the MD5 implementation in BCL will throw.
-// In this case, catch the failure, and not set a checksum.
-let checkSum (url: string) =
- try
- use file = FileSystem.FileStreamReadShim url
- use md5 = System.Security.Cryptography.MD5.Create()
- let checkSum = md5.ComputeHash file
- Some (guidSourceHashMD5, checkSum)
- with _ -> None
+let pdbGetDebugInfo (contentId: byte[]) (timestamp: int32) (filepath: string)
+ (cvChunk: BinaryChunk)
+ (embeddedPdbChunk: BinaryChunk option)
+ (deterministicPdbChunk: BinaryChunk)
+ (checksumPdbChunk: BinaryChunk) (algorithmName:string) (checksum: byte [])
+ (uncompressedLength: int64) (stream: MemoryStream option)
+ (embeddedPdb: bool) (deterministic: bool) =
+ [| yield pdbGetCvDebugInfo contentId timestamp filepath cvChunk
+ yield pdbChecksumDebugInfo timestamp checksumPdbChunk algorithmName checksum
+ if embeddedPdb then
+ match stream, embeddedPdbChunk with
+ | None, _ | _, None -> ()
+ | Some s, Some chunk ->
+ yield pdbGetEmbeddedPdbDebugInfo chunk uncompressedLength s
+ if deterministic then
+ yield pdbGetPdbDebugDeterministicInfo deterministicPdbChunk
+ |]
//------------------------------------------------------------------------------
// PDB Writer. The function [WritePdbInfo] abstracts the
@@ -219,7 +265,7 @@ let getRowCounts tableRowCounts =
tableRowCounts |> Seq.iter(fun x -> builder.Add x)
builder.MoveToImmutable()
-let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) showTimes (info: PdbData) isDeterministic (pathMap: PathMap) =
+let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) checksumAlgorithm showTimes (info: PdbData) (pathMap: PathMap) =
sortMethods showTimes info
let externalRowCounts = getRowCounts info.TableRowCounts
let docs =
@@ -286,7 +332,7 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s
metadata.SetCapacity(TableIndex.Document, docLength)
for doc in docs do
let handle =
- match checkSum doc.File with
+ match checkSum doc.File checksumAlgorithm with
| Some (hashAlg, checkSum) ->
let dbgInfo =
(serializeDocumentName doc.File,
@@ -481,25 +527,28 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s
| None -> MetadataTokens.MethodDefinitionHandle 0
| Some x -> MetadataTokens.MethodDefinitionHandle x
- let deterministicIdProvider isDeterministic : System.Func, BlobContentId> =
- match isDeterministic with
- | false -> null
- | true ->
- let convert (content: IEnumerable) =
- use sha = System.Security.Cryptography.SHA1.Create() // IncrementalHash is core only
- let hash = content
- |> Seq.collect (fun c -> c.GetBytes().Array |> sha.ComputeHash)
- |> Array.ofSeq |> sha.ComputeHash
- BlobContentId.FromHash hash
- System.Func, BlobContentId>( convert )
-
- let serializer = PortablePdbBuilder(metadata, externalRowCounts, entryPoint, deterministicIdProvider isDeterministic)
+ // Compute the contentId for the pdb. Always do it deterministically, since we have to compute the anyway.
+ // The contentId is the hash of the ID using whichever algorithm has been specified to the compiler
+ let mutable contentHash = Array.empty
+
+ let algorithmName, hashAlgorithm =
+ match checksumAlgorithm with
+ | HashAlgorithm.Sha1 -> "SHA1", System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm
+ | HashAlgorithm.Sha256 -> "SHA256", System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm
+ let idProvider: System.Func, BlobContentId> =
+ let convert (content: IEnumerable) =
+ let contentBytes = content |> Seq.collect (fun c -> c.GetBytes()) |> Array.ofSeq
+ contentHash <- contentBytes |> hashAlgorithm.ComputeHash
+ BlobContentId.FromHash contentHash
+ System.Func, BlobContentId>(convert)
+
+ let serializer = PortablePdbBuilder(metadata, externalRowCounts, entryPoint, idProvider)
let blobBuilder = new BlobBuilder()
let contentId= serializer.Serialize blobBuilder
let portablePdbStream = new MemoryStream()
blobBuilder.WriteContentTo portablePdbStream
reportTime showTimes "PDB: Created"
- (portablePdbStream.Length, contentId, portablePdbStream)
+ (portablePdbStream.Length, contentId, portablePdbStream, algorithmName, contentHash)
let compressPortablePdbStream (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) =
let compressedStream = new MemoryStream()
@@ -507,17 +556,17 @@ let compressPortablePdbStream (uncompressedLength: int64) (contentId: BlobConten
stream.WriteTo compressionStream
(uncompressedLength, contentId, compressedStream)
-let writePortablePdbInfo (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb pathMap cvChunk =
+let writePortablePdbInfo (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb pathMap cvChunk deterministicPdbChunk checksumPdbChunk algName checksum embeddedPdb deterministicPdb =
try FileSystem.FileDelete fpdb with _ -> ()
use pdbFile = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite)
stream.WriteTo pdbFile
reportTime showTimes "PDB: Closed"
- pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) (PathMap.apply pathMap fpdb) cvChunk None 0L None
+ pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) (PathMap.apply pathMap fpdb) cvChunk None deterministicPdbChunk checksumPdbChunk algName checksum 0L None embeddedPdb deterministicPdb
-let embedPortablePdbInfo (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk pdbChunk =
+let embedPortablePdbInfo (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk pdbChunk deterministicPdbChunk checksumPdbChunk algName checksum embeddedPdb deterministicPdb =
reportTime showTimes "PDB: Closed"
let fn = Path.GetFileName fpdb
- pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fn cvChunk (Some pdbChunk) uncompressedLength (Some stream)
+ pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fn cvChunk (Some pdbChunk) deterministicPdbChunk checksumPdbChunk algName checksum uncompressedLength (Some stream) embeddedPdb deterministicPdb
#if !FX_NO_PDB_WRITER
//---------------------------------------------------------------------
diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi
index 2713d9769b2..748e178a461 100644
--- a/src/absil/ilwritepdb.fsi
+++ b/src/absil/ilwritepdb.fsi
@@ -4,7 +4,7 @@
module internal FSharp.Compiler.AbstractIL.ILPdbWriter
open Internal.Utilities
-open FSharp.Compiler.AbstractIL.IL
+open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.ErrorLogger
open FSharp.Compiler.Range
open System.Collections.Generic
@@ -83,10 +83,14 @@ type idd =
iddData: byte[];
iddChunk: BinaryChunk }
-val generatePortablePdb : embedAllSource:bool -> embedSourceList:string list -> sourceLink: string -> showTimes:bool -> info:PdbData -> isDeterministic:bool -> pathMap:PathMap -> (int64 * BlobContentId * MemoryStream)
+type HashAlgorithm =
+ | Sha1
+ | Sha256
+
+val generatePortablePdb : embedAllSource: bool -> embedSourceList: string list -> sourceLink: string -> checksumAlgorithm: HashAlgorithm -> showTimes: bool -> info: PdbData -> pathMap:PathMap -> (int64 * BlobContentId * MemoryStream * string * byte[])
val compressPortablePdbStream : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> (int64 * BlobContentId * MemoryStream)
-val embedPortablePdbInfo : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> cvChunk:BinaryChunk -> pdbChunk:BinaryChunk -> idd[]
-val writePortablePdbInfo : contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> pathMap:PathMap -> cvChunk:BinaryChunk -> idd[]
+val embedPortablePdbInfo: uncompressedLength: int64 -> contentId: BlobContentId -> stream: MemoryStream -> showTimes: bool -> fpdb: string -> cvChunk: BinaryChunk -> pdbChunk: BinaryChunk -> deterministicPdbChunk: BinaryChunk -> checksumPdbChunk: BinaryChunk -> algorithmName: string -> checksum: byte[] -> embeddedPDB: bool -> deterministic: bool -> idd[]
+val writePortablePdbInfo: contentId: BlobContentId -> stream: MemoryStream -> showTimes: bool -> fpdb: string -> pathMap: PathMap -> cvChunk: BinaryChunk -> deterministicPdbChunk: BinaryChunk -> checksumPdbChunk: BinaryChunk -> algorithmName: string -> checksum: byte[] -> embeddedPDB: bool -> deterministic: bool -> idd[]
#if !FX_NO_PDB_WRITER
val writePdbInfo : showTimes:bool -> f:string -> fpdb:string -> info:PdbData -> cvChunk:BinaryChunk -> idd[]
diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs
index 85728909cf3..5b75cf1077c 100644
--- a/src/fsharp/CompileOps.fs
+++ b/src/fsharp/CompileOps.fs
@@ -17,6 +17,7 @@ open Internal.Utilities.Text
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.ILBinaryReader
+open FSharp.Compiler.AbstractIL.ILPdbWriter
open FSharp.Compiler.AbstractIL.Internal
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.AbstractIL.Extensions.ILX
@@ -2100,6 +2101,7 @@ type TcConfigBuilder =
mutable maxErrors: int
mutable abortOnError: bool (* intended for fsi scripts that should exit on first error *)
mutable baseAddress: int32 option
+ mutable checksumAlgorithm: HashAlgorithm
#if DEBUG
mutable showOptimizationData: bool
#endif
@@ -2231,6 +2233,7 @@ type TcConfigBuilder =
maxErrors = 100
abortOnError = false
baseAddress = None
+ checksumAlgorithm = HashAlgorithm.Sha256
delaysign = false
publicsign = false
@@ -2740,6 +2743,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member x.flatErrors = data.flatErrors
member x.maxErrors = data.maxErrors
member x.baseAddress = data.baseAddress
+ member x.checksumAlgorithm = data.checksumAlgorithm
#if DEBUG
member x.showOptimizationData = data.showOptimizationData
#endif
diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi
index 71bb7c6f8b6..1262542cd9f 100644
--- a/src/fsharp/CompileOps.fsi
+++ b/src/fsharp/CompileOps.fsi
@@ -10,6 +10,7 @@ open Internal.Utilities
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.ILBinaryReader
+open FSharp.Compiler.AbstractIL.ILPdbWriter
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler
open FSharp.Compiler.TypeChecker
@@ -337,6 +338,7 @@ type TcConfigBuilder =
mutable maxErrors: int
mutable abortOnError: bool
mutable baseAddress: int32 option
+ mutable checksumAlgorithm: HashAlgorithm
#if DEBUG
mutable showOptimizationData: bool
#endif
@@ -497,6 +499,7 @@ type TcConfig =
member maxErrors: int
member baseAddress: int32 option
+ member checksumAlgorithm: HashAlgorithm
#if DEBUG
member showOptimizationData: bool
#endif
diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs
index 0c385cc3670..e548a49e712 100644
--- a/src/fsharp/CompileOptions.fs
+++ b/src/fsharp/CompileOptions.fs
@@ -9,6 +9,7 @@ open System
open FSharp.Compiler
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.AbstractIL.IL
+open FSharp.Compiler.AbstractIL.ILPdbWriter
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.AbstractIL.Extensions.ILX
open FSharp.Compiler.AbstractIL.Diagnostics
@@ -522,6 +523,7 @@ let tagFullPDBOnlyPortable = "{full|pdbonly|portable|embedded}"
let tagWarnList = ""
let tagSymbolList = ""
let tagAddress = ""
+let tagAlgorithm = "{SHA1|SHA256}"
let tagInt = ""
let tagPathMap = ""
let tagNone = ""
@@ -933,6 +935,16 @@ let advancedFlagsFsc tcConfigB =
OptionString (fun s -> tcConfigB.baseAddress <- Some(int32 s)), None,
Some (FSComp.SR.optsBaseaddress()))
+ yield CompilerOption
+ ("checksumalgorithm", tagAlgorithm,
+ OptionString (fun s ->
+ tcConfigB.checksumAlgorithm <-
+ match s.ToUpperInvariant() with
+ | "SHA1" -> HashAlgorithm.Sha1
+ | "SHA256" -> HashAlgorithm.Sha256
+ | _ -> error(Error(FSComp.SR.optsUnknownChecksumAlgorithm s, rangeCmdArgs))), None,
+ Some (FSComp.SR.optsChecksumAlgorithm()))
+
yield noFrameworkFlag true tcConfigB
yield CompilerOption
diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt
index ee2b41f2e9d..831597c031a 100644
--- a/src/fsharp/FSComp.txt
+++ b/src/fsharp/FSComp.txt
@@ -878,6 +878,7 @@ optsUtf8output,"Output messages in UTF-8 encoding"
optsFullpaths,"Output messages with fully qualified paths"
optsLib,"Specify a directory for the include path which is used to resolve source files and assemblies (Short form: -I)"
optsBaseaddress,"Base address for the library to be built"
+optsChecksumAlgorithm,"Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)"
optsNoframework,"Do not reference the default CLI assemblies by default"
optsStandalone,"Statically link the F# library and all referenced DLLs that depend on it into the assembly being generated"
optsStaticlink,"Statically link the given assembly and all referenced DLLs that depend on this assembly. Use an assembly name e.g. mylib, not a DLL name."
@@ -900,6 +901,7 @@ optsHelpBannerLanguage,"- LANGUAGE -"
optsHelpBannerErrsAndWarns,"- ERRORS AND WARNINGS -"
1063,optsUnknownArgumentToTheTestSwitch,"Unknown --test argument: '%s'"
1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'"
+1065,optsUnknownChecksumAlgorithm,"Algorithm '%s' is not supported"
optsInternalNoDescription,"The command-line option '%s' is for test purposes only"
optsDCLONoDescription,"The command-line option '%s' has been deprecated"
optsDCLODeprecatedSuggestAlternative,"The command-line option '%s' has been deprecated. Use '%s' instead."
diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs
index 19d8cd171fa..8080637fcdf 100644
--- a/src/fsharp/FSharp.Build/Fsc.fs
+++ b/src/fsharp/FSharp.Build/Fsc.fs
@@ -24,6 +24,7 @@ type public Fsc () as this =
let mutable baseAddress : string = null
let mutable capturedArguments : string list = [] // list of individual args, to pass to HostObject Compile()
let mutable capturedFilenames : string list = [] // list of individual source filenames, to pass to HostObject Compile()
+ let mutable checksumAlgorithm: string = null
let mutable codePage : string = null
let mutable commandLineArgs : ITaskItem list = []
let mutable debugSymbols = false
@@ -135,7 +136,7 @@ type public Fsc () as this =
builder.AppendSwitch("--tailcalls-")
// PdbFile
builder.AppendSwitchIfNotNull("--pdb:", pdbFile)
- // Platform
+// Platform
builder.AppendSwitchIfNotNull("--platform:",
let ToUpperInvariant (s:string) = if s = null then null else s.ToUpperInvariant()
match ToUpperInvariant(platform), prefer32bit, ToUpperInvariant(targetType) with
@@ -145,6 +146,13 @@ type public Fsc () as this =
| "X86", _, _ -> "x86"
| "X64", _, _ -> "x64"
| _ -> null)
+ // checksumAlgorithm
+ builder.AppendSwitchIfNotNull("--checksumalgorithm:",
+ let ToUpperInvariant (s:string) = if s = null then null else s.ToUpperInvariant()
+ match ToUpperInvariant(checksumAlgorithm) with
+ | "SHA1" -> "Sha1"
+ | "SHA256" -> "Sha256"
+ | _ -> null)
// Resources
if resources <> null then
for item in resources do
@@ -258,6 +266,11 @@ type public Fsc () as this =
with get() = baseAddress
and set(s) = baseAddress <- s
+ // --checksumalgorithm
+ member fsc.ChecksumAlgorithm
+ with get() = checksumAlgorithm
+ and set(s) = checksumAlgorithm <- s
+
// --codepage : Specify the codepage to use when opening source files
member fsc.CodePage
with get() = codePage
diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets
index c36ce52c50f..a5d036b885a 100644
--- a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets
+++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets
@@ -276,6 +276,7 @@ this file.
AbsIL\ilread.fs
-
- AbsIL\ilwrite.fsi
-
AbsIL\ilwritepdb.fsi
AbsIL\ilwritepdb.fs
+
+ AbsIL\ilwrite.fsi
+
AbsIL\ilwrite.fs
diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs
index e4e693e99ca..7799d409e5d 100644
--- a/src/fsharp/fsc.fs
+++ b/src/fsharp/fsc.fs
@@ -2145,6 +2145,7 @@ let main4 dynamicAssemblyCreator (Args (ctok, tcConfig, tcImports: TcImports, t
embedAllSource = tcConfig.embedAllSource
embedSourceList = tcConfig.embedSourceList
sourceLink = tcConfig.sourceLink
+ checksumAlgorithm = tcConfig.checksumAlgorithm
signer = GetStrongNameSigner signingInfo
dumpDebugInfo = tcConfig.dumpDebugInfo
pathMap = tcConfig.pathMap },
diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf
index 3354ee57b5f..883582e5e67 100644
--- a/src/fsharp/xlf/FSComp.txt.cs.xlf
+++ b/src/fsharp/xlf/FSComp.txt.cs.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
Není definovaný obor názvů {0}.
diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf
index 320acf4e03d..12791db46fa 100644
--- a/src/fsharp/xlf/FSComp.txt.de.xlf
+++ b/src/fsharp/xlf/FSComp.txt.de.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
Der Namespace "{0}" ist nicht definiert.
diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf
index b08960e4861..e4096bec532 100644
--- a/src/fsharp/xlf/FSComp.txt.es.xlf
+++ b/src/fsharp/xlf/FSComp.txt.es.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
El espacio de nombres "{0}" no está definido.
diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf
index f23037f6a88..1a0d745e9f2 100644
--- a/src/fsharp/xlf/FSComp.txt.fr.xlf
+++ b/src/fsharp/xlf/FSComp.txt.fr.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
L'espace de noms '{0}' n'est pas défini.
diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf
index 32637f988da..baec2ba7fd6 100644
--- a/src/fsharp/xlf/FSComp.txt.it.xlf
+++ b/src/fsharp/xlf/FSComp.txt.it.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
Lo spazio dei nomi '{0}' non è definito.
diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf
index 8157060c9d8..a2a18f153ad 100644
--- a/src/fsharp/xlf/FSComp.txt.ja.xlf
+++ b/src/fsharp/xlf/FSComp.txt.ja.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
名前空間 '{0}' が定義されていません。
diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf
index f642d6b444d..92ead77838e 100644
--- a/src/fsharp/xlf/FSComp.txt.ko.xlf
+++ b/src/fsharp/xlf/FSComp.txt.ko.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
'{0}' 네임스페이스가 정의되지 않았습니다.
diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf
index b9749bedda5..0187c22d016 100644
--- a/src/fsharp/xlf/FSComp.txt.pl.xlf
+++ b/src/fsharp/xlf/FSComp.txt.pl.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
Nie zdefiniowano przestrzeni nazw „{0}”.
diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf
index 39537bc8cde..1ed97eb22d3 100644
--- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf
+++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
O namespace '{0}' não está definido.
diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf
index fcd4c723f70..bdeac0f9592 100644
--- a/src/fsharp/xlf/FSComp.txt.ru.xlf
+++ b/src/fsharp/xlf/FSComp.txt.ru.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
Пространство имен "{0}" не определено.
diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf
index 80929708832..de62c337f55 100644
--- a/src/fsharp/xlf/FSComp.txt.tr.xlf
+++ b/src/fsharp/xlf/FSComp.txt.tr.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
'{0}' ad alanı tanımlı değil.
diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
index 1a7945d7124..b0264288fb1 100644
--- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
+++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
未定义命名空间“{0}”。
diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
index 0f67d46dbc2..ab73b60a7f4 100644
--- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
+++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
@@ -7,6 +7,16 @@
{0} for F# {1}
+
+
+ Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)
+
+
+
+
+ Algorithm '{0}' is not supported
+
+
未定義命名空間 '{0}'。
diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
index 45974519909..f6395b91c49 100644
--- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
+++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs
@@ -12495,7 +12495,7 @@ namespace ProviderImplementation.ProvidedTypes
let pdbOpt =
match portablePDB with
| true ->
- let (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData deterministic
+ let (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData
if embeddedPDB then Some (compressPortablePdbStream uncompressedLength contentId stream)
else Some (pdbStream)
| _ -> None
diff --git a/tests/fsharp/.gitignore b/tests/fsharp/.gitignore
index 0493c881790..ea4771517da 100644
--- a/tests/fsharp/.gitignore
+++ b/tests/fsharp/.gitignore
@@ -13,4 +13,5 @@ Library1.dll
cd.tmp
-
+*.err
+*.vserr
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs
index 65d7f3ba86d..0c3c619c33e 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs
@@ -39,6 +39,7 @@
//section='- ADVANCED - ' ! option=fullpaths kind=OptionUnit
//section='- ADVANCED - ' ! option=lib kind=OptionStringList
//section='- ADVANCED - ' ! option=baseaddress kind=OptionString
+//section='- ADVANCED - ' ! option=checksumalgorithm kind=OptionString
//section='- ADVANCED - ' ! option=noframework kind=OptionUnit
//section='- ADVANCED - ' ! option=standalone kind=OptionUnit
//section='- ADVANCED - ' ! option=staticlink kind=OptionString
diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
index b0fd6746810..9309a03e5e6 100644
--- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
+++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl
@@ -133,6 +133,10 @@ Copyright (c) Microsoft Corporation. All Rights Reserved.
Default - mscorlib
--baseaddress: Base address for the library to be
built
+--checksumalgorithm:{SHA1|SHA256} Specify algorithm for calculating
+ source file checksum stored in PDB.
+ Supported values are: SHA1 or SHA256
+ (default)
--noframework Do not reference the default CLI
assemblies by default
--standalone Statically link the F# library and
From c70ead8048a2dd7865195bd90edfd64a260dc1e9 Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Sat, 20 Jul 2019 10:04:05 -0700
Subject: [PATCH 13/22] Update dependencies from
https://github.com/dotnet/arcade build 20190719.2 (#7260)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19369.2
---
eng/Version.Details.xml | 4 ++--
global.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 7a60463a0fb..7228968c11e 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- eecde8a8751dbe7fdb17ba4dfbd032e26f4cae7d
+ a190d4865fe3c86a168ec49c4fc61c90c96ae051
diff --git a/global.json b/global.json
index 78425fae2ed..c8c5b129393 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19368.7",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19369.2",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From ff7b8ff392cee40388a08e377138030784c7cc35 Mon Sep 17 00:00:00 2001
From: "Kevin Ransom (msft)"
Date: Mon, 22 Jul 2019 12:24:18 -0700
Subject: [PATCH 14/22] Improve netcore reference selection (#7263)
* Improve netcore reference selection
* Update baselines
---
tests/fsharp/Compiler/CompilerAssert.fs | 87 ++++++++++--
.../Language/SpanOptimizationTests.fs | 124 +++++++++---------
2 files changed, 136 insertions(+), 75 deletions(-)
diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs
index ade3ca8e4a3..52ec325df86 100644
--- a/tests/fsharp/Compiler/CompilerAssert.fs
+++ b/tests/fsharp/Compiler/CompilerAssert.fs
@@ -32,6 +32,76 @@ module CompilerAssert =
let private config = TestFramework.initializeSuite ()
+
+// Do a one time dotnet sdk build to compute the proper set of reference assemblies to pass to the compiler
+#if !NETCOREAPP
+#else
+ let projectFile = """
+
+
+
+ Exe
+ netcoreapp2.1
+
+
+
+
+
+
+
+
+"""
+
+ let programFs = """
+open System
+
+[]
+let main argv = 0"""
+
+ let getNetCoreAppReferences =
+ let mutable output = ""
+ let mutable errors = ""
+ let mutable cleanUp = true
+ let projectDirectory = Path.Combine(Path.GetTempPath(), "netcoreapp2.1", Path.GetRandomFileName())
+ try
+ try
+ Directory.CreateDirectory(projectDirectory) |> ignore
+ let projectFileName = Path.Combine(projectDirectory, "ProjectFile.fsproj")
+ let programFsFileName = Path.Combine(projectDirectory, "Program.fs")
+ let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt")
+
+ File.WriteAllText(projectFileName, projectFile)
+ File.WriteAllText(programFsFileName, programFs)
+
+ let pInfo = ProcessStartInfo ()
+
+ pInfo.FileName <- config.DotNetExe
+ pInfo.Arguments <- "build"
+ pInfo.WorkingDirectory <- projectDirectory
+ pInfo.RedirectStandardOutput <- true
+ pInfo.RedirectStandardError <- true
+ pInfo.UseShellExecute <- false
+
+ let p = Process.Start(pInfo)
+ p.WaitForExit()
+
+ output <- p.StandardOutput.ReadToEnd ()
+ errors <- p.StandardError.ReadToEnd ()
+ if not (String.IsNullOrWhiteSpace errors) then Assert.Fail errors
+
+ if p.ExitCode <> 0 then Assert.Fail(sprintf "Program exited with exit code %d" p.ExitCode)
+
+ File.ReadLines(frameworkReferencesFileName) |> Seq.toArray
+ with | e ->
+ cleanUp <- false
+ printfn "%s" output
+ printfn "%s" errors
+ raise (new Exception (sprintf "An error occured getting netcoreapp references: %A" e))
+ finally
+ if cleanUp then
+ try Directory.Delete(projectDirectory) with | _ -> ()
+#endif
+
let private defaultProjectOptions =
{
ProjectFileName = "Z:\\test.fsproj"
@@ -41,14 +111,7 @@ module CompilerAssert =
OtherOptions = [|"--preferreduilang:en-US";|]
#else
OtherOptions =
- // Hack: Currently a hack to get the runtime assemblies for netcore in order to compile.
- let assemblies =
- typeof.Assembly.Location
- |> Path.GetDirectoryName
- |> Directory.EnumerateFiles
- |> Seq.toArray
- |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system."))
- |> Array.map (fun x -> sprintf "-r:%s" x)
+ let assemblies = getNetCoreAppReferences |> Array.map (fun x -> sprintf "-r:%s" x)
Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies
#endif
ReferencedProjects = [||]
@@ -60,7 +123,7 @@ module CompilerAssert =
ExtraProjectInfo = None
Stamp = None
}
-
+
let private gate = obj ()
let private compile isExe source f =
@@ -110,8 +173,6 @@ module CompilerAssert =
Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors)
-
-
let TypeCheckWithErrors (source: string) expectedTypeErrors =
lock gate <| fun () ->
let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously
@@ -141,7 +202,7 @@ module CompilerAssert =
TypeCheckWithErrors (source: string) [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |]
let CompileExe (source: string) =
- compile true source (fun (errors, _) ->
+ compile true source (fun (errors, _) ->
if errors.Length > 0 then
Assert.Fail (sprintf "Compile had warnings and/or errors: %A" errors))
@@ -216,7 +277,7 @@ module CompilerAssert =
||> Seq.iter2 (fun expectedErrorMessage errorMessage ->
Assert.AreEqual(expectedErrorMessage, errorMessage)
)
-
+
let ParseWithErrors (source: string) expectedParseErrors =
let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously
diff --git a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs
index efcea68afd3..c5fd682e993 100644
--- a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs
+++ b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs
@@ -27,45 +27,45 @@ let test () =
verifier.VerifyIL
[
""".method public static void test() cil managed
-{
-
- .maxstack 5
- .locals init (valuetype [System.Private.CoreLib]System.Span`1 V_0,
- int32 V_1,
- valuetype [System.Private.CoreLib]System.Int32 V_2,
- class [System.Private.CoreLib]System.Object& V_3)
- IL_0000: call valuetype [System.Private.CoreLib]System.Span`1 valuetype [System.Private.CoreLib]System.Span`1::get_Empty()
- IL_0005: stloc.0
- IL_0006: ldc.i4.0
- IL_0007: stloc.2
- IL_0008: ldloca.s V_0
- IL_000a: call instance int32 valuetype [System.Private.CoreLib]System.Span`1::get_Length()
- IL_000f: ldc.i4.1
- IL_0010: sub
- IL_0011: stloc.1
- IL_0012: ldloc.1
- IL_0013: ldloc.2
- IL_0014: blt.s IL_0034
-
- IL_0016: ldloca.s V_0
- IL_0018: ldloc.2
- IL_0019: call instance !0& valuetype [System.Private.CoreLib]System.Span`1::get_Item(int32)
- IL_001e: stloc.3
- IL_001f: ldloc.3
- IL_0020: ldobj [System.Private.CoreLib]System.Object
- IL_0025: call void [System.Console]System.Console::WriteLine(object)
- IL_002a: ldloc.2
- IL_002b: ldc.i4.1
- IL_002c: add
- IL_002d: stloc.2
- IL_002e: ldloc.2
- IL_002f: ldloc.1
- IL_0030: ldc.i4.1
- IL_0031: add
- IL_0032: bne.un.s IL_0016
-
- IL_0034: ret
-} """
+ {
+
+ .maxstack 5
+ .locals init (valuetype [System.Runtime]System.Span`1
diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
index 750052c45db..ee7a88b29d6 100644
--- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
+++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec
@@ -38,13 +38,11 @@
-
-
From 8e843ae254c7c1e2fd29dbe23e0b45e5fbf514d2 Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Thu, 25 Jul 2019 17:47:38 -0700
Subject: [PATCH 19/22] [master] Update dependencies from dotnet/arcade (#7269)
* Update dependencies from https://github.com/dotnet/arcade build 20190723.6
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19373.6
* Update dependencies from https://github.com/dotnet/arcade build 20190724.2
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19374.2
* Update dependencies from https://github.com/dotnet/arcade build 20190725.2
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.2
---
eng/Version.Details.xml | 4 +--
eng/common/build.sh | 0
eng/common/cibuild.sh | 0
eng/common/cross/armel/tizen-build-rootfs.sh | 0
eng/common/cross/armel/tizen-fetch.sh | 0
eng/common/cross/build-android-rootfs.sh | 0
eng/common/cross/build-rootfs.sh | 0
eng/common/darc-init.sh | 0
eng/common/dotnet-install.sh | 0
eng/common/init-tools-native.sh | 0
eng/common/internal-feed-operations.sh | 0
eng/common/msbuild.sh | 0
eng/common/native/common-library.sh | 0
eng/common/native/install-cmake.sh | 0
eng/common/performance/performance-setup.sh | 0
eng/common/pipeline-logging-functions.sh | 0
eng/common/post-build/darc-gather-drop.ps1 | 36 +++++++++++++++++++
.../channels/internal-servicing.yml | 23 ------------
.../channels/public-dev-release.yml | 24 ++-----------
.../post-build/channels/public-release.yml | 23 ------------
.../channels/public-validation-release.yml | 26 ++------------
.../templates/post-build/darc-gather-drop.yml | 22 ++++++++++++
.../post-build/trigger-subscription.yml | 2 +-
eng/common/tools.sh | 0
global.json | 2 +-
25 files changed, 68 insertions(+), 94 deletions(-)
mode change 100644 => 100755 eng/common/build.sh
mode change 100644 => 100755 eng/common/cibuild.sh
mode change 100644 => 100755 eng/common/cross/armel/tizen-build-rootfs.sh
mode change 100644 => 100755 eng/common/cross/armel/tizen-fetch.sh
mode change 100644 => 100755 eng/common/cross/build-android-rootfs.sh
mode change 100644 => 100755 eng/common/cross/build-rootfs.sh
mode change 100644 => 100755 eng/common/darc-init.sh
mode change 100644 => 100755 eng/common/dotnet-install.sh
mode change 100644 => 100755 eng/common/init-tools-native.sh
mode change 100644 => 100755 eng/common/internal-feed-operations.sh
mode change 100644 => 100755 eng/common/msbuild.sh
mode change 100644 => 100755 eng/common/native/common-library.sh
mode change 100644 => 100755 eng/common/native/install-cmake.sh
mode change 100644 => 100755 eng/common/performance/performance-setup.sh
mode change 100644 => 100755 eng/common/pipeline-logging-functions.sh
create mode 100644 eng/common/post-build/darc-gather-drop.ps1
create mode 100644 eng/common/templates/post-build/darc-gather-drop.yml
mode change 100644 => 100755 eng/common/tools.sh
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index e278bed29a9..1ed95d393af 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- 0793e2df782efc9ccae387bc779b2549208fa4a1
+ 3dfa62fddcde597959c323d17426f215384e773a
diff --git a/eng/common/build.sh b/eng/common/build.sh
old mode 100644
new mode 100755
diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh
old mode 100644
new mode 100755
diff --git a/eng/common/cross/armel/tizen-build-rootfs.sh b/eng/common/cross/armel/tizen-build-rootfs.sh
old mode 100644
new mode 100755
diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh
old mode 100644
new mode 100755
diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh
old mode 100644
new mode 100755
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
old mode 100644
new mode 100755
diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh
old mode 100644
new mode 100755
diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh
old mode 100644
new mode 100755
diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh
old mode 100644
new mode 100755
diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh
old mode 100644
new mode 100755
diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh
old mode 100644
new mode 100755
diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh
old mode 100644
new mode 100755
diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh
old mode 100644
new mode 100755
diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh
old mode 100644
new mode 100755
diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh
old mode 100644
new mode 100755
diff --git a/eng/common/post-build/darc-gather-drop.ps1 b/eng/common/post-build/darc-gather-drop.ps1
new file mode 100644
index 00000000000..9cc2f1a0091
--- /dev/null
+++ b/eng/common/post-build/darc-gather-drop.ps1
@@ -0,0 +1,36 @@
+param(
+ [Parameter(Mandatory=$true)][string] $BarBuildId, # ID of the build which assets should be downloaded
+ [Parameter(Mandatory=$true)][string] $MaestroAccessToken, # Token used to access Maestro API
+ [Parameter(Mandatory=$true)][string] $DropLocation # Where the assets should be downloaded to
+)
+
+$ErrorActionPreference = "Stop"
+Set-StrictMode -Version 2.0
+
+. $PSScriptRoot\..\tools.ps1
+
+try {
+ Write-Host "Installing DARC ..."
+
+ . $PSScriptRoot\..\darc-init.ps1
+ $exitCode = $LASTEXITCODE
+
+ if ($exitCode -ne 0) {
+ Write-PipelineTaskError "Something failed while running 'darc-init.ps1'. Check for errors above. Exiting now..."
+ ExitWithExitCode $exitCode
+ }
+
+ darc gather-drop --non-shipping `
+ --continue-on-error `
+ --id $BarBuildId `
+ --output-dir $DropLocation `
+ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ `
+ --password $MaestroAccessToken `
+ --latest-location
+}
+catch {
+ Write-Host $_
+ Write-Host $_.Exception
+ Write-Host $_.ScriptStackTrace
+ ExitWithExitCode 1
+}
diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml
index 648e854e0ed..5c07b66926f 100644
--- a/eng/common/templates/post-build/channels/internal-servicing.yml
+++ b/eng/common/templates/post-build/channels/internal-servicing.yml
@@ -143,29 +143,6 @@ stages:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1
arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion)
- - job:
- displayName: Gather Drop
- dependsOn: setupMaestroVars
- variables:
- BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id)
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Setup Darc CLI
- inputs:
- targetType: filePath
- filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1'
-
- - task: PowerShell@2
- displayName: Run Darc gather-drop
- inputs:
- targetType: inline
- script: |
- darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location
- enabled: false
-
- template: ../promote-build.yml
parameters:
ChannelId: ${{ variables.InternalServicing_30_Channel_Id }}
diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml
index bdc631016b6..b46b0699233 100644
--- a/eng/common/templates/post-build/channels/public-dev-release.yml
+++ b/eng/common/templates/post-build/channels/public-dev-release.yml
@@ -140,27 +140,9 @@ stages:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1
arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion)
- - job:
- displayName: Gather Drop
- dependsOn: setupMaestroVars
- variables:
- BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id)
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Setup Darc CLI
- inputs:
- targetType: filePath
- filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1'
-
- - task: PowerShell@2
- displayName: Run Darc gather-drop
- inputs:
- targetType: inline
- script: |
- darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location
+ - template: ../darc-gather-drop.yml
+ parameters:
+ ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }}
- template: ../promote-build.yml
parameters:
diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml
index f6a7efdfe9d..a31d37139b7 100644
--- a/eng/common/templates/post-build/channels/public-release.yml
+++ b/eng/common/templates/post-build/channels/public-release.yml
@@ -143,29 +143,6 @@ stages:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1
arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion)
- - job:
- displayName: Gather Drop
- dependsOn: setupMaestroVars
- variables:
- BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id)
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Setup Darc CLI
- inputs:
- targetType: filePath
- filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1'
-
- - task: PowerShell@2
- displayName: Run Darc gather-drop
- inputs:
- targetType: inline
- script: |
- darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location
- enabled: false
-
- template: ../promote-build.yml
parameters:
ChannelId: ${{ variables.PublicRelease_30_Channel_Id }}
diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml
index f12f402ad9a..02dae0937da 100644
--- a/eng/common/templates/post-build/channels/public-validation-release.yml
+++ b/eng/common/templates/post-build/channels/public-validation-release.yml
@@ -91,29 +91,9 @@ stages:
jobs:
- template: ../setup-maestro-vars.yml
- - job:
- displayName: Gather Drop
- dependsOn: setupMaestroVars
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id)
- variables:
- - name: BARBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- - group: Publish-Build-Assets
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Setup Darc CLI
- inputs:
- targetType: filePath
- filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1'
-
- - task: PowerShell@2
- displayName: Run Darc gather-drop
- inputs:
- targetType: inline
- script: |
- darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) --latest-location
+ - template: ../darc-gather-drop.yml
+ parameters:
+ ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }}
- template: ../promote-build.yml
parameters:
diff --git a/eng/common/templates/post-build/darc-gather-drop.yml b/eng/common/templates/post-build/darc-gather-drop.yml
new file mode 100644
index 00000000000..e0a9f0a6d26
--- /dev/null
+++ b/eng/common/templates/post-build/darc-gather-drop.yml
@@ -0,0 +1,22 @@
+parameters:
+ ChannelId: 0
+
+jobs:
+- job: gatherDrop
+ displayName: Gather Drop
+ dependsOn: setupMaestroVars
+ condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], ${{ parameters.ChannelId }})
+ variables:
+ - group: Publish-Build-Assets
+ - name: BARBuildId
+ value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
+ pool:
+ vmImage: 'windows-2019'
+ steps:
+ - task: PowerShell@2
+ displayName: Darc gather-drop
+ inputs:
+ filePath: $(Build.SourcesDirectory)/eng/common/post-build/darc-gather-drop.ps1
+ arguments: -BarBuildId $(BARBuildId)
+ -DropLocation $(Agent.BuildDirectory)/Temp/Drop/
+ -MaestroAccessToken $(MaestroAccessToken)
diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml
index 65259d4e685..3915cdcd1ad 100644
--- a/eng/common/templates/post-build/trigger-subscription.yml
+++ b/eng/common/templates/post-build/trigger-subscription.yml
@@ -8,4 +8,4 @@ steps:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1
arguments: -SourceRepo $(Build.Repository.Uri)
-ChannelId ${{ parameters.ChannelId }}
- -BarToken $(MaestroAccessTokenInt)
\ No newline at end of file
+ -BarToken $(MaestroAccessToken)
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
old mode 100644
new mode 100755
diff --git a/global.json b/global.json
index 1d496dc84bf..ef694a9855a 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19372.10",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.2",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From ce483c0e01625949a49aeb45c97d87d0549773c5 Mon Sep 17 00:00:00 2001
From: "dotnet-maestro[bot]"
<42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date: Fri, 26 Jul 2019 12:37:13 -0700
Subject: [PATCH 20/22] Update dependencies from
https://github.com/dotnet/arcade build 20190725.15 (#7282)
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.15
---
eng/Version.Details.xml | 4 +--
eng/common/init-tools-native.ps1 | 2 +-
eng/common/native/CommonLibrary.psm1 | 33 +++++++++++++++++--
.../channels/public-dev-release.yml | 2 +-
.../channels/public-validation-release.yml | 2 +-
eng/common/tools.sh | 4 +--
global.json | 2 +-
7 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 1ed95d393af..7a0a634b410 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,9 +3,9 @@
-
+
https://github.com/dotnet/arcade
- 3dfa62fddcde597959c323d17426f215384e773a
+ ef1c110152df0d500fffb87878a86f88d1ca5295
diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1
index eaa05880c55..8cf18bcfeba 100644
--- a/eng/common/init-tools-native.ps1
+++ b/eng/common/init-tools-native.ps1
@@ -98,7 +98,7 @@ try {
}
Write-Verbose "Installing $ToolName version $ToolVersion"
- Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'"
+ Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'"
& $InstallerPath @LocalInstallerArguments
if ($LASTEXITCODE -Ne "0") {
$errMsg = "$ToolName installation failed"
diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1
index 7a34c7e8a42..2a08d5246e7 100644
--- a/eng/common/native/CommonLibrary.psm1
+++ b/eng/common/native/CommonLibrary.psm1
@@ -59,9 +59,38 @@ function DownloadAndExtract {
-Verbose:$Verbose
if ($UnzipStatus -Eq $False) {
- Write-Error "Unzip failed"
- return $False
+ # Retry Download one more time with Force=true
+ $DownloadRetryStatus = CommonLibrary\Get-File -Uri $Uri `
+ -Path $TempToolPath `
+ -DownloadRetries 1 `
+ -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds `
+ -Force:$True `
+ -Verbose:$Verbose
+
+ if ($DownloadRetryStatus -Eq $False) {
+ Write-Error "Last attempt of download failed as well"
+ return $False
+ }
+
+ # Retry unzip again one more time with Force=true
+ $UnzipRetryStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath `
+ -OutputDirectory $InstallDirectory `
+ -Force:$True `
+ -Verbose:$Verbose
+ if ($UnzipRetryStatus -Eq $False)
+ {
+ Write-Error "Last attempt of unzip failed as well"
+ # Clean up partial zips and extracts
+ if (Test-Path $TempToolPath) {
+ Remove-Item $TempToolPath -Force
+ }
+ if (Test-Path $InstallDirectory) {
+ Remove-Item $InstallDirectory -Force -Recurse
+ }
+ return $False
+ }
}
+
return $True
}
diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml
index b46b0699233..4eaa6e4ff0f 100644
--- a/eng/common/templates/post-build/channels/public-dev-release.yml
+++ b/eng/common/templates/post-build/channels/public-dev-release.yml
@@ -77,7 +77,7 @@ stages:
filePath: eng\common\sdk-task.ps1
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
/p:ChannelId=$(PublicDevRelease_30_Channel_Id)
- /p:ArtifactsCategory=.NetCore
+ /p:ArtifactsCategory=$(_DotNetArtifactsCategory)
/p:IsStableBuild=$(IsStableBuild)
/p:IsInternalBuild=$(IsInternalBuild)
/p:RepositoryName=$(Build.Repository.Name)
diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml
index 02dae0937da..8c4d8f6ef33 100644
--- a/eng/common/templates/post-build/channels/public-validation-release.yml
+++ b/eng/common/templates/post-build/channels/public-validation-release.yml
@@ -48,7 +48,7 @@ stages:
filePath: eng\common\sdk-task.ps1
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
/p:ChannelId=$(PublicValidationRelease_30_Channel_Id)
- /p:ArtifactsCategory=.NetCoreValidation
+ /p:ArtifactsCategory=$(_DotNetArtifactsCategory)
/p:IsStableBuild=$(IsStableBuild)
/p:IsInternalBuild=$(IsInternalBuild)
/p:RepositoryName=$(Build.Repository.Name)
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index 0deb01c480b..738bb5669da 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -77,7 +77,7 @@ function ReadGlobalVersion {
local pattern="\"$key\" *: *\"(.*)\""
if [[ ! $line =~ $pattern ]]; then
- Write-PipelineTelemetryError -category 'InitializeTools' "Error: Cannot find \"$key\" in $global_json_file"
+ Write-PipelineTelemetryError -category 'InitializeToolset' "Error: Cannot find \"$key\" in $global_json_file"
ExitWithExitCode 1
fi
@@ -245,7 +245,7 @@ function InitializeNativeTools() {
then
local nativeArgs=""
if [[ "$ci" == true ]]; then
- nativeArgs="-InstallDirectory $tools_dir"
+ nativeArgs="--installDirectory $tools_dir"
fi
"$_script_dir/init-tools-native.sh" $nativeArgs
fi
diff --git a/global.json b/global.json
index ef694a9855a..67df8eb1531 100644
--- a/global.json
+++ b/global.json
@@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.2",
+ "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.15",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
From 969a9c4661b277093aedf804e92d68532f991b92 Mon Sep 17 00:00:00 2001
From: "Kevin Ransom (msft)"
Date: Fri, 26 Jul 2019 15:42:35 -0700
Subject: [PATCH 21/22] Fix test assert (#7283)
---
tests/fsharp/Compiler/CompilerAssert.fs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs
index 9f64824bb48..c663e9b9c29 100644
--- a/tests/fsharp/Compiler/CompilerAssert.fs
+++ b/tests/fsharp/Compiler/CompilerAssert.fs
@@ -290,8 +290,10 @@ let main argv = 0"""
Assert.AreEqual(expectedErrorMessage, errorMessage)
)
- let ParseWithErrors (source: string) expectedParseErrors =
- let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously
+ let ParseWithErrors (source: string) expectedParseErrors =
+ let sourceFileName = "test.fs"
+ let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| sourceFileName |] }
+ let parseResults = checker.ParseFile(sourceFileName, SourceText.ofString source, parsingOptions) |> Async.RunSynchronously
Assert.True(parseResults.ParseHadErrors)
From c03755fa47fe9660b40394b3e45779b9e02e409b Mon Sep 17 00:00:00 2001
From: Kevin Ransom
Date: Fri, 26 Jul 2019 21:31:00 -0700
Subject: [PATCH 22/22] disablewarningtests
---
.../ErrorMessages/WarnExpressionTests.fs | 45 +++++++++++--------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
index 557aa81a4d4..7bf6cc211c1 100644
--- a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
+++ b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
@@ -105,9 +105,10 @@ let changeX() =
(6, 5, 6, 15)
"The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
- []
+ // [] // Disable this test until we refactor tcImports and tcGlobals
let ``Warn If Discarded In List``() =
- CompilerAssert.TypeCheckSingleError
+ CompilerAssert.TypeCheckWithErrorsAndOptions
+ [| "--langversion:4.6" |]
"""
let div _ _ = 1
let subView _ _ = [1; 2]
@@ -119,14 +120,17 @@ let view model dispatch =
div [] []
]
"""
- FSharpErrorSeverity.Warning
- 3221
- (9, 8, 9, 17)
- "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'."
+ [|
+ FSharpErrorSeverity.Warning,
+ 3221,
+ (9, 8, 9, 17),
+ "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'."
+ |]
- []
+ // [] // Disable this test until we refactor tcImports and tcGlobals
let ``Warn If Discarded In List 2``() =
- CompilerAssert.TypeCheckSingleError
+ CompilerAssert.TypeCheckWithErrorsAndOptions
+ [| "--langversion:4.6" |]
"""
// stupid things to make the sample compile
let div _ _ = 1
@@ -143,14 +147,17 @@ let view model dispatch =
]
]
"""
- FSharpErrorSeverity.Warning
- 3222
- (13, 19, 13, 41)
- "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'."
+ [|
+ FSharpErrorSeverity.Warning,
+ 3222,
+ (13, 19, 13, 41),
+ "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'."
+ |]
- []
+ // [] // Disable this test until we refactor tcImports and tcGlobals
let ``Warn If Discarded In List 3``() =
- CompilerAssert.TypeCheckSingleError
+ CompilerAssert.TypeCheckWithErrorsAndOptions
+ [| "--langversion:4.6" |]
"""
// stupid things to make the sample compile
let div _ _ = 1
@@ -167,10 +174,12 @@ let view model dispatch =
]
]
"""
- FSharpErrorSeverity.Warning
- 20
- (13, 19, 13, 41)
- "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+ [|
+ FSharpErrorSeverity.Warning,
+ 20,
+ (13, 19, 13, 41),
+ "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
+ |]
[]
let ``Warn Only On Last Expression``() =