Skip to content

Commit 2669c9b

Browse files
authored
Merge branch 'main' into fix-10697
2 parents a15afa2 + c4ed80c commit 2669c9b

File tree

126 files changed

+799
-578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+799
-578
lines changed

tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Checked =
1212
[<Theory; FileInlineData("unchecked01.fs")>]
1313
let ``fsc-unchecked - unchecked01_fs`` compilation =
1414
compilation
15-
|> getCompilation
15+
|> getCompilation
1616
|> asFs
1717
|> compile
1818
|> shouldSucceed

tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic.fs

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace Conformance.UnitsOfMeasure
4+
5+
open Xunit
6+
open FSharp.Test
7+
open FSharp.Test.Compiler
8+
9+
module Basic =
10+
let shouldFailWithDiagnostics expectedDiagnostics compilation =
11+
compilation
12+
|> asLibrary
13+
|> withOptions ["--test:ErrorRanges"]
14+
|> typecheck
15+
|> shouldFail
16+
|> withDiagnostics expectedDiagnostics
17+
18+
let shouldSucceed compilation =
19+
compilation
20+
|> asLibrary
21+
|> withOptions ["--test:ErrorRanges"]
22+
|> typecheck
23+
|> shouldSucceed
24+
25+
[<FileInlineData("Calculus.fsx")>]
26+
[<FileInlineData("Mars.fsx")>]
27+
[<FileInlineData("MassForce.fsx")>]
28+
[<FileInlineData("Misc01.fsx")>]
29+
[<FileInlineData("Misc03.fsx")>]
30+
[<FileInlineData("Misc04.fsx")>]
31+
[<FileInlineData("Quotation04_hidden.fsx")>]
32+
[<FileInlineData("RationalExponents01.fsx")>]
33+
[<FileInlineData("Stats.fsx")>]
34+
[<FileInlineData("SI.fsx")>]
35+
[<Theory>]
36+
let ``Basic - shouldSucceed`` compilation =
37+
compilation
38+
|> getCompilation
39+
|> shouldSucceed
40+
41+
[<Theory; FileInlineData("E_MassForce.fsx")>]
42+
let ``Basic - E_MassForce`` compilation =
43+
compilation
44+
|> getCompilation
45+
|> shouldFailWithDiagnostics [
46+
(Error 1, Line 15, Col 27, Line 15, Col 32, "The unit of measure 'N' does not match the unit of measure 'kg'")
47+
(Error 43, Line 15, Col 25, Line 15, Col 26, "The unit of measure 'N' does not match the unit of measure 'kg'")
48+
]
49+
50+
[<Theory; FileInlineData("Misc02.fsx")>]
51+
let ``Basic - Misc02_fs`` compilation =
52+
compilation
53+
|> getCompilation
54+
|> shouldFailWithDiagnostics [
55+
(Warning 64, Line 36, Col 60, Line 36, Col 61, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'v has been constrained to be measure ''u/'w'.")
56+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ let rec newton (f:float<_> -> float<_>) f' x xacc =
1818
else newton f f' x' xacc
1919

2020
// Non-regular datatype: a list of derivatives of a function
21+
[<NoComparison;NoEquality>]
2122
type derivs<[<Measure>] 'u, [<Measure>] 'v> =
2223
Nil
2324
| Cons of (float<'u> -> float<'v>) * derivs<'u,'v/'u>

0 commit comments

Comments
 (0)