Skip to content

Commit fcca186

Browse files
authored
Merge pull request #11207 from dotnet/merges/main-to-release/dev17.0
2 parents 67ae831 + 2b7517d commit fcca186

File tree

12 files changed

+56
-27
lines changed

12 files changed

+56
-27
lines changed

src/fsharp/CheckDeclarations.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ module TcRecdUnionAndEnumDeclarations =
454454

455455
let ValidateFieldNames (synFields: SynField list, tastFields: RecdField list) =
456456
let seen = Dictionary()
457-
for (sf, f) in List.zip synFields tastFields do
457+
(synFields, tastFields) ||> List.iter2 (fun sf f ->
458458
match seen.TryGetValue f.Name with
459459
| true, synField ->
460460
match sf, synField with
@@ -465,7 +465,7 @@ module TcRecdUnionAndEnumDeclarations =
465465
error(Error(FSComp.SR.tcFieldNameConflictsWithGeneratedNameForAnonymousField(id.idText), id.idRange))
466466
| _ -> assert false
467467
| _ ->
468-
seen.Add(f.Name, sf)
468+
seen.Add(f.Name, sf))
469469

470470
let TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv (SynUnionCase(Attributes synAttrs, id, args, xmldoc, vis, m)) =
471471
let attrs = TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs // the attributes of a union case decl get attached to the generated "static factory" method

src/fsharp/CheckExpressions.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,10 +4023,10 @@ and TcValSpec cenv env declKind newOk containerInfo memFlagsOpt thisTyOpt tpenv
40234023
if SynInfo.HasOptionalArgs valSynInfo then
40244024
let curriedArgTys, returnTy = GetTopTauTypeInFSharpForm cenv.g argsData ty' m
40254025
let curriedArgTys =
4026-
(List.zip (List.mapSquared fst curriedArgTys) valSynInfo.CurriedArgInfos)
4027-
|> List.map (fun (argTys, argInfos) ->
4028-
(List.zip argTys argInfos)
4029-
|> List.map (fun (argty, argInfo) ->
4026+
((List.mapSquared fst curriedArgTys), valSynInfo.CurriedArgInfos)
4027+
||> List.map2 (fun argTys argInfos ->
4028+
(argTys, argInfos)
4029+
||> List.map2 (fun argty argInfo ->
40304030
if SynInfo.IsOptionalArg argInfo then mkOptionTy cenv.g argty
40314031
else argty))
40324032
mkIteratedFunTy (List.map (mkRefTupledTy cenv.g) curriedArgTys) returnTy

src/fsharp/IlxGen.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,8 +1552,8 @@ type AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbu
15521552
tycon.entity_tycon_repr <-
15531553
TRecdRepr
15541554
(Construct.MakeRecdFieldsTable
1555-
[ for (tp, (propName, _fldName, _fldTy)) in (List.zip tps flds) ->
1556-
Construct.NewRecdField false None (mkSynId m propName) false (mkTyparTy tp) true false [] [] XmlDoc.Empty taccessPublic false ])
1555+
((tps, flds) ||> List.map2 (fun tp (propName, _fldName, _fldTy) ->
1556+
Construct.NewRecdField false None (mkSynId m propName) false (mkTyparTy tp) true false [] [] XmlDoc.Empty taccessPublic false)))
15571557

15581558
let tcref = mkLocalTyconRef tycon
15591559
let _, typ = generalizeTyconRef tcref

src/fsharp/NicePrint.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,9 @@ module private PrintTypes =
895895
let typesWithDiscrimants,typarsAndCxs = PrettyTypes.PrettifyDiscriminantAndTypePairs denv.g typesWithDiscrimants
896896
let retTy = typesWithDiscrimants |> List.find (function (0, _) -> true | _ -> false) |> snd
897897
let argInfos =
898-
typesWithDiscrimants
898+
typesWithDiscrimants
899899
|> List.choose (function (1,ty) -> Some ty | _ -> None)
900-
|> List.zip argInfos
901-
|> List.map (fun ((_,argInfo),tTy) -> tTy, argInfo)
900+
|> List.map2 (fun (_, argInfo) tTy -> tTy, argInfo) argInfos
902901
let genParamTys =
903902
typesWithDiscrimants
904903
|> List.choose (function (2,ty) -> Some ty | _ -> None)

src/fsharp/ParseAndCheckInputs.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ let ParseOneInputFile (tcConfig: TcConfig, lexResourceManager, conditionalCompil
426426
let ParseInputFiles (tcConfig: TcConfig, lexResourceManager, conditionalCompilationDefines, sourceFiles, errorLogger: ErrorLogger, exiter: Exiter, createErrorLogger: (Exiter -> CapturingErrorLogger), retryLocked) =
427427
try
428428
let isLastCompiland, isExe = sourceFiles |> tcConfig.ComputeCanContainEntryPoint
429-
let sourceFiles = isLastCompiland |> List.zip sourceFiles |> Array.ofSeq
429+
let sourceFiles = isLastCompiland |> List.zip sourceFiles |> Array.ofList
430430

431431
if tcConfig.concurrentBuild then
432432
let mutable exitCode = 0

src/fsharp/TypedTreeOps.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4933,7 +4933,7 @@ let InferArityOfExpr g allowTypeDirectedDetupling ty partialArgAttribsL retAttri
49334933
assert (List.length vsl = List.length dtys)
49344934

49354935
let curriedArgInfos =
4936-
(List.zip vsl dtys) |> List.mapi (fun i (vs, ty) ->
4936+
(vsl, dtys) ||> List.mapi2 (fun i vs ty ->
49374937
let partialAttribs = if i < partialArgAttribsL.Length then partialArgAttribsL.[i] else []
49384938
let tys =
49394939
match allowTypeDirectedDetupling with

src/fsharp/service/FSharpParseFileResults.fs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,
127127

128128
override _.VisitBinding(_path, defaultTraverse, binding) =
129129
match binding with
130-
| SynBinding(_, _, _, _, _, _, _, _, _, expr, _range, _) as b when rangeContainsPos b.RangeOfBindingWithRhs pos ->
130+
| SynBinding(_, _, _, _, _, _, SynValData (None, _, _), _, _, expr, _range, _) as b when rangeContainsPos b.RangeOfBindingWithRhs pos ->
131131
match tryGetIdentRangeFromBinding b with
132132
| Some range -> walkBinding expr range
133133
| None -> None
@@ -158,6 +158,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,
158158
SyntaxTraversal.Traverse(pos, input, { new SyntaxVisitorBase<_>() with
159159
member _.VisitExpr(_, traverseSynExpr, defaultTraverse, expr) =
160160
match expr with
161+
| SynExpr.TypeApp (_, _, _, _, _, _, range) when rangeContainsPos range pos ->
162+
Some range
161163
| SynExpr.App(_, _, _, SynExpr.CompExpr (_, _, expr, _), range) when rangeContainsPos range pos ->
162164
traverseSynExpr expr
163165
| SynExpr.App (_, _, _, _, range) when rangeContainsPos range pos ->
@@ -176,6 +178,9 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,
176178
| SynExpr.Paren (expr, _, _, range) when rangeContainsPos range pos ->
177179
getIdentRangeForFuncExprInApp traverseSynExpr expr pos
178180

181+
| SynExpr.TypeApp (expr, _, _, _, _, _, _) ->
182+
getIdentRangeForFuncExprInApp traverseSynExpr expr pos
183+
179184
| SynExpr.App (_, _, funcExpr, argExpr, _) ->
180185
match argExpr with
181186
| SynExpr.App (_, _, _, _, range) when rangeContainsPos range pos ->
@@ -269,6 +274,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput,
269274
SyntaxTraversal.Traverse(pos, input, { new SyntaxVisitorBase<_>() with
270275
member _.VisitExpr(_, traverseSynExpr, defaultTraverse, expr) =
271276
match expr with
277+
| SynExpr.TypeApp (expr, _, _, _, _, _, range) when rangeContainsPos range pos ->
278+
getIdentRangeForFuncExprInApp traverseSynExpr expr pos
272279
| SynExpr.App (_, _, _funcExpr, _, range) as app when rangeContainsPos range pos ->
273280
getIdentRangeForFuncExprInApp traverseSynExpr app pos
274281
| _ -> defaultTraverse expr

src/fsharp/service/ServiceDeclarationLists.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,8 @@ module internal DescriptionListsImpl =
580580

581581
// Remake the params using the prettified versions
582582
let parameters =
583-
(prettyParamTys, prettyParamTysL)
584-
||> List.zip
585-
|> List.map (fun (tau, tyL) ->
583+
(prettyParamTys, prettyParamTysL)
584+
||> List.map2 (fun tau tyL ->
586585
let display = LayoutRender.toArray tyL
587586
MethodGroupItemParameter(
588587
name = "",

src/fsharp/symbols/SymbolHelpers.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,17 +680,17 @@ module internal SymbolHelpers =
680680
| Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref1, n1))), Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref2, n2))) ->
681681
(tyconRefEq g tcref1 tcref2) && (n1 = n2) // there is no direct function as in the previous case
682682
| Item.Property(_, pi1s), Item.Property(_, pi2s) ->
683-
List.zip pi1s pi2s |> List.forall(fun (pi1, pi2) -> PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2)
683+
(pi1s, pi2s) ||> List.forall2 (fun pi1 pi2 -> PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2)
684684
| Item.Event evt1, Item.Event evt2 ->
685685
EventInfo.EventInfosUseIdenticalDefinitions evt1 evt2
686686
| Item.AnonRecdField(anon1, _, i1, _), Item.AnonRecdField(anon2, _, i2, _) ->
687687
anonInfoEquiv anon1 anon2 && i1 = i2
688688
| Item.CtorGroup(_, meths1), Item.CtorGroup(_, meths2) ->
689-
List.zip meths1 meths2
690-
|> List.forall (fun (minfo1, minfo2) -> MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2)
689+
(meths1, meths2)
690+
||> List.forall2 (fun minfo1 minfo2 -> MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2)
691691
| Item.UnqualifiedType tcRefs1, Item.UnqualifiedType tcRefs2 ->
692-
List.zip tcRefs1 tcRefs2
693-
|> List.forall (fun (tcRef1, tcRef2) -> tyconRefEq g tcRef1 tcRef2)
692+
(tcRefs1, tcRefs2)
693+
||> List.forall2 (fun tcRef1 tcRef2 -> tyconRefEq g tcRef1 tcRef2)
694694
| Item.Types(_, [TType.TType_app(tcRef1, _)]), Item.UnqualifiedType([tcRef2]) -> tyconRefEq g tcRef1 tcRef2
695695
| Item.UnqualifiedType([tcRef1]), Item.Types(_, [TType.TType_app(tcRef2, _)]) -> tyconRefEq g tcRef1 tcRef2
696696
| _ -> false)

tests/FSharp.Test.Utilities/Compiler.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ module rec Compiler =
605605
// TODO: Check all "categories", collect all results and print alltogether.
606606
checkEqual "Errors count" expected.Length errors.Length
607607

608-
List.zip errors expected
609-
|> List.iter (fun (actualError, expectedError) ->
608+
(errors, expected)
609+
||> List.iter2 (fun actualError expectedError ->
610610
let { Error = actualError; Range = actualRange; Message = actualMessage } = actualError
611611
let { Error = expectedError; Range = expectedRange; Message = expectedMessage } = expectedError
612612
checkEqual "Error" expectedError actualError

0 commit comments

Comments
 (0)