Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1177340

Browse files
author
dotnet-automerge-bot
authored
Merge pull requestdotnet#5637 from Microsoft/merges/master-to-dev16.0
Merge master to dev16.0
2 parents4935554 +7dbfae8 commit1177340

File tree

34 files changed

+3814
-3736
lines changed

34 files changed

+3814
-3736
lines changed

‎TESTGUIDE.md‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ To run tests, use variations such as the following, depending on which test suit
1010
build.cmd vs test
1111
build.cmd all test
1212

13+
You can also submit pull requests tohttp://github.com/Microsoft/visualfsharp and run the tests via continuoous integration. Most people do wholesale testing that way.
14+
1315
##Prerequisites
1416

1517
It is recommended that you run tests from an elevated command prompt, as there are a couple of test cases which require administrative privileges.
@@ -35,12 +37,12 @@ The F# tests are split as follows:
3537

3638
This is compiled using[tests\fsharp\FSharp.Tests.FSharpSuite.fsproj](tests/fsharp/FSharp.Tests.FSharpSuite.fsproj) to a unit test DLL which acts as a driver script. Each individual test is an NUnit test case, and so you can run it like any other NUnit test.
3739

40+
.\build.cmd net40 test-net40-fsharp
41+
3842
Tests are grouped in folders per area. Each test compiles and executes a`test.fsx|fs` file in its folder using some combination of compiler or FSI flags specified in the FSharpSuite test project.
3943
If the compilation and execution encounter no errors, the test is considered to have passed.
4044

41-
There are also negative tests checking code expected to fail compilation.
42-
43-
See note about baseline under "Other Tips" bellow for tests checking expectations against "baseline" files.
45+
There are also negative tests checking code expected to fail compilation. See note about baseline under "Other Tips" bellow for tests checking expectations against "baseline" files.
4446

4547
###FSharpQA Suite
4648

@@ -75,7 +77,6 @@ Note that for compatibility reasons, the IDE unit tests should be run in a 32-bi
7577
using the`--x86` flag to`nunit3-console.exe`
7678

7779

78-
7980
###Logs and output
8081

8182
All test execution logs and result files will be dropped into the`tests\TestResults` folder, and have file names matching
@@ -86,6 +87,20 @@ All test execution logs and result files will be dropped into the `tests\TestRes
8687
net40-coreunit-suite-*.*
8788
vs-ideunit-suite-*.*
8889

90+
###Baselines
91+
92+
FSharp Test Suite works with couples of .bsl (or .bslpp) files considered "expected" and called baseline, those are matched against the actual output which resides under .err or .vserr files of same name at the during test execution.
93+
When doing so keep in mind to carefully review the diff before comitting updated baseline files.
94+
.bslpp (baseline pre-process) files are specially designed to enable substitution of certain tokens to generate the .bsl file. You can look further about the pre-processing logic under[tests/fsharp/TypeProviderTests.fs](tests/fsharp/TypeProviderTests.fs), this is used only for type provider tests for now.
95+
96+
To update baselines use this:
97+
98+
fsi tests\scripts\update-baselines.fsx
99+
100+
Use`-n` to dry-run:
101+
102+
fsi tests\scripts\update-baselines.fsx -n
103+
89104
###Other Tips
90105

91106
####Run as Administrator
@@ -98,12 +113,3 @@ Do this, or a handful of tests will fail.
98113
* The FSharp and FSharpQA suites will run test cases in parallel by default. You can comment out the relevant line (look for`PARALLEL_ARG`) to disable this.
99114
* By default, tests from the FSharpQA suite are run using a persistent, hosted version of the compiler. This speeds up test execution, as there is no need for the`fsc.exe` process to spin up repeatedly. To disable this, uncomment the relevant line (look for`HOSTED_COMPILER`).
100115

101-
####Test outcome against baseline
102-
103-
FSharp Test Suite works with couples of .bsl (or .bslpp) files considered "expected" and called baseline, those are matched against the actual output which resides under .err or .vserr files of same name at the during test execution.
104-
105-
When working on changes generating conflicts with the baseline, you can use the helper script[tests/fsharp/update.base.line.with.actuals.fsx](tests/fsharp/update.base.line.with.actuals.fsx) to update all .bsl based on the matching .err file.
106-
107-
When doing so keep in mind to carefully review the diff before comitting updated baseline files.
108-
109-
.bslpp (baseline pre-process) files are specially designed to enable substitution of certain tokens to generate the .bsl file. You can look further about the pre-processing logic under[tests/fsharp/TypeProviderTests.fs](tests/fsharp/TypeProviderTests.fs), this is used only for type provider tests for now.

‎src/fsharp/IlxGen.fs‎

Lines changed: 76 additions & 61 deletions
Large diffs are not rendered by default.

‎src/fsharp/Optimizer.fs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,8 +2210,11 @@ and TryOptimizeValInfo cenv env m vinfo =
22102210
//-------------------------------------------------------------------------
22112211

22122212
andAddValEqualityInfo g m(v:ValRef)info=
2213-
if v.IsMutablethen
2214-
/// the env assumes known-values do not change
2213+
// ValValue is information that v = v2, where v2 does not change
2214+
// So we can't record this information for mutable values. An exception can be made
2215+
// for "outArg" values arising from method calls since they are only temporarily mutable
2216+
// when their address is passed to the method call.
2217+
if v.IsMutable&&not(v.IsCompilerGenerated&& v.DisplayName.StartsWith(PrettyNaming.outArgCompilerGeneratedName))then
22152218
info
22162219
else
22172220
{infowith Info= MakeValueInfoForValue g m v info.Info}

‎src/fsharp/PrettyNaming.fs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,3 +694,5 @@ module public Microsoft.FSharp.Compiler.PrettyNaming
694694
| Some vwhen v= actualArgValue-> None
695695
|_-> Some(defaultArgName, actualArgValue))
696696
mangleProvidedTypeName(nm, nonDefaultArgs)
697+
698+
letoutArgCompilerGeneratedName="outArg"

‎src/fsharp/TypeChecker.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10005,7 +10005,7 @@ and TcMethodApplication
1000510005
finalUnnamedCalledOutArgs |> List.map (fun calledArg ->
1000610006
let calledArgTy = calledArg.CalledArgumentType
1000710007
let outArgTy = destByrefTy cenv.g calledArgTy
10008-
let outv, outArgExpr = mkMutableCompGenLocal mMethExpr"outArg" outArgTy // mutable!
10008+
let outv, outArgExpr = mkMutableCompGenLocal mMethExprPrettyNaming.outArgCompilerGeneratedName outArgTy // mutable!
1000910009
let expr = mkDefault(mMethExpr, outArgTy)
1001010010
let callerArg = CallerArg(calledArgTy, mMethExpr, false, mkValAddr mMethExpr false (mkLocalValRef outv))
1001110011
let outArg = { NamedArgIdOpt=None;CalledArg=calledArg;CallerArg=callerArg }

‎src/fsharp/service/service.fs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,13 +1324,23 @@ type TypeCheckInfo
13241324
letunderlyingTy= stripTyEqnsAndMeasureEqns g ty
13251325
isStructTy g underlyingTy
13261326

1327+
letIsValRefMutable(vref:ValRef)=
1328+
// Mutable values, ref cells, and non-inref byrefs are mutable.
1329+
vref.IsMutable
1330+
|| Tastops.isRefCellTy g vref.Type
1331+
||(Tastops.isByrefTy g vref.Type&&not(Tastops.isInByrefTy g vref.Type))
1332+
1333+
letisRecdFieldMutable(rfinfo:RecdFieldInfo)=
1334+
(rfinfo.RecdField.IsMutable&& rfinfo.LiteralValue.IsNone)
1335+
|| Tastops.isRefCellTy g rfinfo.RecdField.FormalType
1336+
13271337
resolutions
13281338
|> Seq.choose(fun cnr->
13291339
match cnrwith
13301340
// 'seq' in 'seq { ... }' gets colored as keywords
13311341
| CNR(_,(Item.Value vref), ItemOccurence.Use,_,_,_, m)when valRefEq g g.seq_vref vref->
13321342
Some(m, SemanticClassificationType.ComputationExpression)
1333-
| CNR(_,(Item.Value vref),_,_,_,_, m)whenvref.IsMutable|| Tastops.isRefCellTy gvref.Type->
1343+
| CNR(_,(Item.Value vref),_,_,_,_, m)whenIsValRefMutablevref->
13341344
Some(m, SemanticClassificationType.MutableVar)
13351345
| CNR(_, Item.Value KeywordIntrinsicValue, ItemOccurence.Use,_,_,_, m)->
13361346
Some(m, SemanticClassificationType.IntrinsicFunction)
@@ -1343,7 +1353,7 @@ type TypeCheckInfo
13431353
Some(m, SemanticClassificationType.Operator)
13441354
else
13451355
Some(m, SemanticClassificationType.Function)
1346-
| CNR(_, Item.RecdField rfinfo,_,_,_,_, m)whenrfinfo.RecdField.IsMutable&&rfinfo.LiteralValue.IsNone->
1356+
| CNR(_, Item.RecdField rfinfo,_,_,_,_, m)whenisRecdFieldMutablerfinfo->
13471357
Some(m, SemanticClassificationType.MutableVar)
13481358
| CNR(_, Item.RecdField rfinfo,_,_,_,_, m)when isFunction g rfinfo.FieldType->
13491359
Some(m, SemanticClassificationType.Function)

‎tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl‎

Lines changed: 73 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
.assembly extern FSharp.Core
1414
{
1515
.publickeytoken= (B0 3F 5F 7F11 D5 0A 3A )// .?_....:
16-
.ver4:4:1:0
16+
.ver4:4:3:0
1717
}
1818
.assembly GenIter01
1919
{
@@ -29,20 +29,20 @@
2929
}
3030
.mresource public FSharpSignatureData.GenIter01
3131
{
32-
// Offset: 0x00000000 Length:0x000001F7
32+
// Offset: 0x00000000 Length:0x000001FF
3333
}
3434
.mresource public FSharpOptimizationData.GenIter01
3535
{
36-
// Offset:0x00000200 Length: 0x0000007A
36+
// Offset:0x00000208 Length: 0x0000007A
3737
}
3838
.module GenIter01.exe
39-
// MVID: {59B19213-F836-DC98-A745-03831392B159}
39+
// MVID: {5B17FC4F-F836-DC98-A745-03834FFC175B}
4040
.imagebase 0x00400000
4141
.file alignment 0x00000200
4242
.stackreserve 0x00100000
4343
.subsystem 0x0003// WINDOWS_CUI
4444
.corflags 0x00000001// ILONLY
45-
// Image base:0x00720000
45+
// Image base:0x02EB0000
4646

4747

4848
// =============== CLASS MEMBERS DECLARATION ===================
@@ -200,121 +200,119 @@
200200
.method public strict virtual instance void
201201
Close() cil managed
202202
{
203-
// Code size150 (0x96)
203+
// Code size148 (0x94)
204204
.maxstack6
205205
.locals init ([0] class [mscorlib]System.Exception V_0,
206206
[1] class [FSharp.Core]Microsoft.FSharp.Core.Unit V_1,
207207
[2] class [mscorlib]System.Exception e)
208208
.line100001,100001 :0,0 ''
209-
IL_0000: ldnull
210-
IL_0001: stloc.0
211-
IL_0002: ldarg.0
212-
IL_0003: ldfld int32 GenIter01/squaresOfOneToTen@5::pc
213-
IL_0008: ldc.i4.3
214-
IL_0009: sub
215-
IL_000a: switch (
216-
IL_0015)
217-
IL_0013: br.s IL_001b
209+
IL_0000: ldarg.0
210+
IL_0001: ldfld int32 GenIter01/squaresOfOneToTen@5::pc
211+
IL_0006: ldc.i4.3
212+
IL_0007: sub
213+
IL_0008: switch (
214+
IL_0013)
215+
IL_0011: br.s IL_0019
218216

219217
.line100001,100001 :0,0 ''
220-
IL_0015: nop
221-
IL_0016: brIL_0089
218+
IL_0013: nop
219+
IL_0014: brIL_0087
222220

223221
.line100001,100001 :0,0 ''
224-
IL_001b: nop
222+
IL_0019: nop
225223
.try
226224
{
227-
IL_001c: ldarg.0
228-
IL_001d: ldfld int32 GenIter01/squaresOfOneToTen@5::pc
229-
IL_0022: switch (
225+
IL_001a: ldarg.0
226+
IL_001b: ldfld int32 GenIter01/squaresOfOneToTen@5::pc
227+
IL_0020: switch (
228+
IL_0037,
230229
IL_0039,
231230
IL_003b,
232-
IL_003d,
233-
IL_003f)
234-
IL_0037: br.s IL_004d
231+
IL_003d)
232+
IL_0035: br.s IL_004b
235233

236-
IL_0039: br.sIL_0041
234+
IL_0037: br.sIL_003f
237235

238-
IL_003b: br.sIL_0044
236+
IL_0039: br.sIL_0042
239237

240-
IL_003d: br.sIL_0047
238+
IL_003b: br.sIL_0045
241239

242-
IL_003f: br.sIL_004a
240+
IL_003d: br.sIL_0048
243241

244242
.line100001,100001 :0,0 ''
245-
IL_0041: nop
246-
IL_0042: br.sIL_0063
243+
IL_003f: nop
244+
IL_0040: br.sIL_0061
247245

248246
.line100001,100001 :0,0 ''
249-
IL_0044: nop
250-
IL_0045: br.sIL_004f
247+
IL_0042: nop
248+
IL_0043: br.sIL_004d
251249

252250
.line100001,100001 :0,0 ''
253-
IL_0047: nop
254-
IL_0048: br.sIL_004e
251+
IL_0045: nop
252+
IL_0046: br.sIL_004c
255253

256254
.line100001,100001 :0,0 ''
257-
IL_004a: nop
258-
IL_004b: br.sIL_0063
255+
IL_0048: nop
256+
IL_0049: br.sIL_0061
259257

260258
.line100001,100001 :0,0 ''
261-
IL_004d: nop
259+
IL_004b: nop
262260
.line100001,100001 :0,0 ''
263-
IL_004e: nop
264-
IL_004f: ldarg.0
265-
IL_0050: ldc.i4.3
266-
IL_0051: stfld int32 GenIter01/squaresOfOneToTen@5::pc
267-
IL_0056: ldarg.0
268-
IL_0057: ldfld class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> GenIter01/squaresOfOneToTen@5::'enum'
269-
IL_005c: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::Dispose<class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>>(!!0)
270-
IL_0061: nop
261+
IL_004c: nop
262+
IL_004d: ldarg.0
263+
IL_004e: ldc.i4.3
264+
IL_004f: stfld int32 GenIter01/squaresOfOneToTen@5::pc
265+
IL_0054: ldarg.0
266+
IL_0055: ldfld class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> GenIter01/squaresOfOneToTen@5::'enum'
267+
IL_005a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::Dispose<class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>>(!!0)
268+
IL_005f: nop
271269
.line100001,100001 :0,0 ''
272-
IL_0062: nop
273-
IL_0063: ldarg.0
274-
IL_0064: ldc.i4.3
275-
IL_0065: stfld int32 GenIter01/squaresOfOneToTen@5::pc
276-
IL_006a: ldarg.0
277-
IL_006b: ldc.i4.0
278-
IL_006c: stfld int32 GenIter01/squaresOfOneToTen@5::current
279-
IL_0071: ldnull
280-
IL_0072: stloc.1
281-
IL_0073: leave.sIL_0081
270+
IL_0060: nop
271+
IL_0061: ldarg.0
272+
IL_0062: ldc.i4.3
273+
IL_0063: stfld int32 GenIter01/squaresOfOneToTen@5::pc
274+
IL_0068: ldarg.0
275+
IL_0069: ldc.i4.0
276+
IL_006a: stfld int32 GenIter01/squaresOfOneToTen@5::current
277+
IL_006f: ldnull
278+
IL_0070: stloc.1
279+
IL_0071: leave.sIL_007f
282280

283281
}// end .try
284282
catch [mscorlib]System.Object
285283
{
286-
IL_0075: castclass [mscorlib]System.Exception
287-
IL_007a: stloc.2
284+
IL_0073: castclass [mscorlib]System.Exception
285+
IL_0078: stloc.2
288286
.line5,6 :7,23 ''
289-
IL_007b: ldloc.2
290-
IL_007c: stloc.0
291-
IL_007d: ldnull
292-
IL_007e: stloc.1
293-
IL_007f: leave.sIL_0081
287+
IL_0079: ldloc.2
288+
IL_007a: stloc.0
289+
IL_007b: ldnull
290+
IL_007c: stloc.1
291+
IL_007d: leave.sIL_007f
294292

295293
.line100001,100001 :0,0 ''
296294
}// end handler
297-
IL_0081: ldloc.1
298-
IL_0082: pop
295+
IL_007f: ldloc.1
296+
IL_0080: pop
299297
.line100001,100001 :0,0 ''
300-
IL_0083: nop
301-
IL_0084: brIL_0002
298+
IL_0081: nop
299+
IL_0082: brIL_0000
302300

303-
IL_0089: ldloc.0
304-
IL_008a: ldnull
305-
IL_008b: cgt.un
306-
IL_008d: brfalse.sIL_0091
301+
IL_0087: ldloc.0
302+
IL_0088: ldnull
303+
IL_0089: cgt.un
304+
IL_008b: brfalse.sIL_008f
307305

308-
IL_008f: br.sIL_0093
306+
IL_008d: br.sIL_0091
309307

310-
IL_0091: br.sIL_0095
308+
IL_008f: br.sIL_0093
311309

312310
.line100001,100001 :0,0 ''
313-
IL_0093: ldloc.0
314-
IL_0094: throw
311+
IL_0091: ldloc.0
312+
IL_0092: throw
315313

316314
.line100001,100001 :0,0 ''
317-
IL_0095: ret
315+
IL_0093: ret
318316
}// end of method squaresOfOneToTen@5::Close
319317

320318
.method public strict virtual instance bool

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp