Skip to content

Commit 2598fb1

Browse files
authored
Fix a bunch of typos (#18439)
1 parent 0566db0 commit 2598fb1

File tree

14 files changed

+601
-606
lines changed

14 files changed

+601
-606
lines changed

src/Compiler/Checking/CheckPatterns.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ and TcPat warnOnUpper (cenv: cenv) env valReprInfo vFlags (patEnv: TcPatLinearEn
269269

270270
| SynPat.As (pat1, pat2, m) ->
271271
TcPatUnnamedAs warnOnUpper cenv env vFlags patEnv ty pat1 pat2 m
272-
272+
273273
| SynPat.Named (SynIdent(id,_), isMemberThis, vis, m) ->
274274
TcPatNamed warnOnUpper cenv env vFlags patEnv id ty isMemberThis vis valReprInfo m
275275

@@ -522,7 +522,7 @@ and IsNameOf (cenv: cenv) (env: TcEnv) ad m (id: Ident) =
522522
/// Check a long identifier in a pattern
523523
and TcPatLongIdent warnOnUpper cenv env ad valReprInfo vFlags (patEnv: TcPatLinearEnv) ty (longDotId, tyargs, args, vis, m) =
524524
let (SynLongIdent(longId, _, _)) = longDotId
525-
525+
526526
if tyargs.IsSome then errorR(Error(FSComp.SR.tcInvalidTypeArgumentUsage(), m))
527527

528528
let warnOnUpperForId =
@@ -643,7 +643,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
643643
// Here we only care about the cases where the user has written the wildcard pattern explicitly
644644
// | Case _ -> ...
645645
// let myDiscardedArgFunc(Case _) = ..."""
646-
// This needs to be a waring because it was a valid pattern in version 7.0 and earlier and we don't want to break existing code.
646+
// This needs to be a warning because it was a valid pattern in version 7.0 and earlier and we don't want to break existing code.
647647
// The rest of the cases will still be reported as FS0725
648648
warning(Error(FSComp.SR.matchNotAllowedForUnionCaseWithNoData(), m))
649649
| _ -> ()
@@ -725,7 +725,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
725725
if numArgTys > 1 then
726726
// Expects tuple without enough args
727727
let printTy = NicePrint.minimalStringOfType env.DisplayEnv
728-
let missingArgs =
728+
let missingArgs =
729729
argNames.[numArgs..numArgTys - 1]
730730
|> List.map (fun id -> (if id.rfield_name_generated then "" else id.DisplayName + ": ") + printTy id.FormalType)
731731
|> String.concat (Environment.NewLine + "\t")

src/Compiler/Checking/Expressions/CheckComputationExpressions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ let inline addVarsToVarSpace (varSpace: LazyWithContext<Val list * TcEnv, range>
914914
/// Try translate the syntax sugar
915915
/// </summary>
916916
/// <param name="ceenv">Computation expression context (carrying caches, environments, ranges, etc)</param>
917-
/// <param name="firstTry">Flag if it's inital check</param>
917+
/// <param name="firstTry">Flag if it's initial check</param>
918918
/// <param name="q">a flag indicating if custom operators are allowed. They are not allowed inside try/with, try/finally, if/then/else etc.</param>
919919
/// <param name="varSpace">a lazy data structure indicating the variables bound so far in the overall computation</param>
920920
/// <param name="comp">the computation expression being analyzed</param>
@@ -2793,7 +2793,7 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var
27932793
| Some(thenExpr, None) ->
27942794
let elseExprOptOpt =
27952795
match elseCompOpt with
2796-
// When we are missing an 'else' part alltogether in case of 'if cond then return exp', we fallback from BindReturn into regular Bind+Return
2796+
// When we are missing an 'else' part altogether in case of 'if cond then return exp', we fallback from BindReturn into regular Bind+Return
27972797
| None -> None
27982798
| Some elseComp ->
27992799
match convertSimpleReturnToExpr ceenv comp varSpace elseComp with

src/Compiler/Checking/PatternMatchCompilation.fs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ exception CannotRefute
197197

198198
[<Struct>]
199199
[<RequireQualifiedAccess>]
200-
type CounterExampleType =
200+
type CounterExampleType =
201201
/// Maps to EnumMatchIncomplete exn
202-
| EnumCoversKnown
202+
| EnumCoversKnown
203203
/// Maps to MatchIncomplete exn
204-
| WithoutEnum
204+
| WithoutEnum
205205
with member x.Combine(other) = match other with EnumCoversKnown -> other | _ -> x
206206

207207
let RefuteDiscrimSet g m path discrims : Expr * CounterExampleType =
@@ -366,7 +366,7 @@ let ShowCounterExample g denv m refuted =
366366
| [] -> raise CannotRefute
367367
| (r, eck) :: t ->
368368
((r, eck), t) ||> List.fold (fun (rAcc, eckAcc) (r, eck) ->
369-
CombineRefutations g rAcc r, eckAcc.Combine(eck))
369+
CombineRefutations g rAcc r, eckAcc.Combine(eck))
370370
let text = LayoutRender.showL (NicePrint.dataExprL denv counterExample)
371371
let failingWhenClause = refuted |> List.exists (function RefutedWhenClause -> true | _ -> false)
372372
Some(text, failingWhenClause, enumCoversKnown)
@@ -400,7 +400,7 @@ let rec isMemOfActives p1 actives =
400400
| [] -> false
401401
| Active(p2, _, _) :: rest -> pathEq p1 p2 || isMemOfActives p1 rest
402402

403-
// Find the information about the active investigation
403+
// Find the information about the active investigation
404404
let rec lookupActive x l =
405405
match l with
406406
| [] -> raise (KeyNotFoundException())
@@ -423,13 +423,13 @@ type Implication =
423423
/// Work out what a successful type test (against tgtTy1) implies about a null test for the same input value.
424424
///
425425
/// Example:
426-
/// match x with
426+
/// match x with
427427
/// | :? string when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
428428
/// | null -> ...
429429
/// For any inputs where ':? string' succeeds, 'null' will fail
430430
///
431431
/// Example:
432-
/// match x with
432+
/// match x with
433433
/// | :? (int option) when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
434434
/// | null -> ...
435435
/// Nothing can be learned. If ':? (int option)' succeeds, 'null' may still have to be run.
@@ -442,7 +442,7 @@ let computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 =
442442
/// Work out what a failing type test (against tgtTy1) implies about a null test for the same input value.
443443
///
444444
/// Example:
445-
/// match x with
445+
/// match x with
446446
/// | :? (int option) -> ...
447447
/// | null -> ...
448448
/// If ':? (int option)' fails then 'null' will fail
@@ -455,13 +455,13 @@ let computeWhatFailingTypeTestImpliesAboutNullTest g tgtTy1 =
455455
/// Work out what one successful null test implies about a type test (against tgtTy2) for the same input value.
456456
///
457457
/// Example:
458-
/// match x with
458+
/// match x with
459459
/// | null when false -> ... // note: "when false" used so null test succeeds but proceed to next type test
460460
/// | :? string -> ...
461461
/// For any inputs where 'null' succeeds, ':? string' will fail
462462
///
463463
/// Example:
464-
/// match x with
464+
/// match x with
465465
/// | null when false -> ... // note: "when false" used so null test succeeds but proceed to next type test
466466
/// | :? (int option) -> ...
467467
/// For any inputs where 'null' succeeds, ':? (int option)' will succeed
@@ -487,12 +487,12 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
487487
// supertypes (tgtTy2) always succeed.
488488
//
489489
// Example:
490-
// match x with
490+
// match x with
491491
// | :? string when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
492492
// | :? IComparable -> ...
493493
//
494494
// Example:
495-
// match x with
495+
// match x with
496496
// | :? string when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
497497
// | :? string -> ...
498498
//
@@ -503,15 +503,15 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
503503
// type tests of the same object against a unrelated target type (tgtTy2) fails.
504504
//
505505
// Example:
506-
// match x with
506+
// match x with
507507
// | :? int when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
508508
// | :? string -> ...
509509
//
510510
// For any inputs where ':? int' succeeds, ':? string' will fail
511511
//
512512
//
513513
// This only applies if tgtTy2 is not potentially related to the sealed type tgtTy1:
514-
// match x with
514+
// match x with
515515
// | :? int when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
516516
// | :? IComparable -> ...
517517
//
@@ -520,15 +520,15 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
520520
//
521521
//
522522
// This rule also doesn't apply to unsealed types:
523-
// match x with
523+
// match x with
524524
// | :? SomeUnsealedClass when false -> ... // note: "when false" used so type test succeeds but proceed to next type test
525525
// | :? SomeInterface -> ...
526526
// because the input may be some subtype of SomeUnsealedClass and that type could implement SomeInterface even if
527527
// SomeUnsealedClass doesnt.
528528
//
529529
//
530530
// This rule also doesn't apply to types with null as true value:
531-
// match x with
531+
// match x with
532532
// | :? (int option) when false -> ... // "when false" means type test succeeds but proceed to next type test
533533
// | :? (string option) -> ...
534534
//
@@ -542,7 +542,7 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
542542
// a type test of the same input value against an unrelated non-interface type (tgtTy2) always fails
543543
//
544544
// Example:
545-
// match x with
545+
// match x with
546546
// | :? SomeUnsealedClass when false -> ... // "when false" used so type test succeeds but proceed to next type test
547547
// | :? SomeUnrelatedClass -> ...
548548
//
@@ -562,7 +562,7 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
562562
// always fails.
563563
//
564564
// Example:
565-
// match x with
565+
// match x with
566566
// | :? IComparable when false -> ... // "when false" used so type test succeeds but proceed to next type test
567567
// | :? SomeOtherSealedClass -> ...
568568
//
@@ -586,12 +586,12 @@ let computeWhatFailingTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 =
586586
// testing the same input value against an equivalent or subtype type (tgtTy2) always fails.
587587
//
588588
// Example:
589-
// match x with
589+
// match x with
590590
// | :? IComparable -> ...
591591
// | :? string -> ...
592592
//
593593
// Example:
594-
// match x with
594+
// match x with
595595
// | :? string -> ...
596596
// | :? string -> ...
597597
if TypeDefinitelySubsumesTypeNoCoercion 0 g amap m tgtTy1 tgtTy2 then
@@ -696,15 +696,15 @@ let discrimWithinSimultaneousClass g amap m discrim prev =
696696

697697
| DecisionTreeTest.IsNull, _ ->
698698
// Check that each previous test in the set, if successful, gives some information about this test
699-
prev |> List.forall (fun edge ->
699+
prev |> List.forall (fun edge ->
700700
match edge with
701701
| DecisionTreeTest.IsNull -> true
702702
| DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 <> Implication.Nothing
703703
| _ -> false)
704704

705705
| DecisionTreeTest.IsInst (_, tgtTy2), _ ->
706706
// Check that each previous test in the set, if successful, gives some information about this test
707-
prev |> List.forall (fun edge ->
707+
prev |> List.forall (fun edge ->
708708
match edge with
709709
| DecisionTreeTest.IsNull -> true
710710
| DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 <> Implication.Nothing
@@ -885,8 +885,8 @@ let rec investigationPoints inpPat =
885885
match inpPat with
886886
| TPat_query((_, _, _, _, _, apinfo), subPat, _) ->
887887
Array.prepend (not apinfo.IsTotal) (investigationPoints subPat)
888-
| TPat_isinst(_, _tgtTy, subPatOpt, _) ->
889-
match subPatOpt with
888+
| TPat_isinst(_, _tgtTy, subPatOpt, _) ->
889+
match subPatOpt with
890890
| None -> singleFalseInvestigationPoint
891891
| Some subPat -> Array.prepend false (investigationPoints subPat)
892892
| TPat_as(subPat, _, _) -> investigationPoints subPat
@@ -904,7 +904,7 @@ let rec investigationPoints inpPat =
904904
|> Seq.collect investigationPoints
905905
|> Seq.toArray
906906
|> Array.prepend false
907-
| TPat_null _
907+
| TPat_null _
908908
| TPat_const _ -> singleFalseInvestigationPoint
909909
| TPat_wild _
910910
| TPat_error _ -> [||]
@@ -930,7 +930,7 @@ let rec erasePartialPatterns inpPat =
930930

931931
and erasePartials inps =
932932
List.map erasePartialPatterns inps
933-
933+
934934
let ReportUnusedTargets (clauses: MatchClause list) dtree =
935935
match dtree, clauses with
936936
| TDSuccess _, [ _ ] -> ()
@@ -948,7 +948,7 @@ let ReportUnusedTargets (clauses: MatchClause list) dtree =
948948
| [ head ] -> head.Id.idRange
949949
| _ -> c.Pattern.Range
950950
| _, Some guard -> guard.Range
951-
951+
952952
withStartEnd c.Range.Start m.End m
953953
|> RuleNeverMatched
954954
|> warning)
@@ -994,10 +994,10 @@ let CompilePatternBasic
994994
let mutable firstIncompleteMatchClauseWithThrowExpr = None
995995
let warningsGenerated = new ResizeArray<CounterExampleType>(2)
996996
let getIncompleteMatchClause refuted =
997-
// Emit the incomplete match warning.
997+
// Emit the incomplete match warning.
998998
if warnOnIncomplete then
999999
match actionOnFailure with
1000-
| ThrowIncompleteMatchException
1000+
| ThrowIncompleteMatchException
10011001
| IgnoreWithWarning ->
10021002
let ignoreWithWarning = (actionOnFailure = IgnoreWithWarning)
10031003
let counterExample = ShowCounterExample g denv mMatch refuted
@@ -1070,7 +1070,7 @@ let CompilePatternBasic
10701070

10711071
| ThrowIncompleteMatchException ->
10721072
mkThrow mMatch resultTy
1073-
(mkExnExpr(g.MatchFailureException_tcr,
1073+
(mkExnExpr(g.MatchFailureException_tcr,
10741074
[ mkString g mMatch mMatch.FileName
10751075
mkInt g mMatch mMatch.StartLine
10761076
mkInt g mMatch mMatch.StartColumn], mMatch))
@@ -1259,7 +1259,7 @@ let CompilePatternBasic
12591259
| ActivePatternReturnKind.Boolean -> false
12601260
let vOpt, addrExp, _readonly, _writeonly = mkExprAddrOfExprAux g mustTakeAddress false NeverMutates appExpr None mMatch
12611261
match vOpt with
1262-
| None ->
1262+
| None ->
12631263
let v, vExpr = mkCompGenLocal m ("activePatternResult" + string (newUnique())) resTy
12641264
if origInputVal.IsMemberOrModuleBinding then
12651265
AdjustValToHaveValReprInfo v origInputVal.TryDeclaringEntity ValReprInfo.emptyValData
@@ -1316,7 +1316,7 @@ let CompilePatternBasic
13161316
if not total && aparity > 1 then
13171317
error(Error(FSComp.SR.patcPartialActivePatternsGenerateOneResult(), m))
13181318

1319-
if not total then
1319+
if not total then
13201320
match retKind with
13211321
| ActivePatternReturnKind.Boolean -> DecisionTreeTest.Const(Const.Bool true)
13221322
| ActivePatternReturnKind.RefTypeWrapper -> DecisionTreeTest.UnionCase(mkAnySomeCase g false, resTys)
@@ -1497,7 +1497,7 @@ let CompilePatternBasic
14971497
match discrim with
14981498
| DecisionTreeTest.IsInst (_srcTy, tgtTy2) ->
14991499
match computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy2 tgtTy1 with
1500-
| Implication.Succeeds ->
1500+
| Implication.Succeeds ->
15011501
match pbindOpt with
15021502
| Some pbind ->
15031503
let subAccess tpinst exprIn =
@@ -1534,7 +1534,7 @@ let CompilePatternBasic
15341534
match discrim with
15351535
| DecisionTreeTest.IsNull ->
15361536
[Frontier (i, newActives, valMap)]
1537-
| DecisionTreeTest.IsInst (_, tgtTy) ->
1537+
| DecisionTreeTest.IsInst (_, tgtTy) ->
15381538
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy with
15391539
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
15401540
| Implication.Fails -> []
@@ -1637,7 +1637,7 @@ let CompilePatternBasic
16371637
// - Partial active patterns
16381638
// - Disjunctive patterns
16391639
// - Pattern clauses with 'when'
1640-
// - isinst patterns
1640+
// - isinst patterns
16411641
//
16421642
// Partial active patterns that are not the "last" thing in a clause,
16431643
// combined with subsequent clauses, can cause significant code expansion
@@ -1666,13 +1666,13 @@ let CompilePatternBasic
16661666
// a partial pattern. This can lead to sub-standard code generation
16671667
// but has long been the technique we use to avoid blow-up of pattern matching.
16681668
//
1669-
// Disjunctive patterns combined with 'when' clauses can also cause signficant code
1669+
// Disjunctive patterns combined with 'when' clauses can also cause significant code
16701670
// expansion. In particular this leads to multiple copies of 'when' expressions (even for one clause)
16711671
// and each failure path of those 'when' will then continue on the expand any remaining
16721672
// pattern logic in subsequent clauses. So when generating code we take clauses up
16731673
// until the first one containing a disjunctive pattern with a 'when' clause.
16741674
//
1675-
// Disjunction will still cause significant expansion, e.g.
1675+
// Disjunction will still cause significant expansion, e.g.
16761676
// (A | B), (C | D) ->
16771677
// is immediately expanded out to four frontiers each with two investigation points.
16781678
// A, C -> ...
@@ -1682,7 +1682,7 @@ let CompilePatternBasic
16821682
//
16831683
// Of course, some decision-logic expansion here is expected. Further, for unions, integers, characters, enums etc.
16841684
// the column-based matching on A/B and C/D eliminates these relatively efficiently, e.g. to
1685-
// one-switch-on-A/B
1685+
// one-switch-on-A/B
16861686
// on each path, one switch on C/D
16871687
// So disjunction alone isn't considered problematic, but in combination with 'when' patterns
16881688

@@ -1702,7 +1702,7 @@ let rec CompilePattern g denv amap tcVal infoReader mExpr mMatch warnOnUnused a
17021702
// First make sure we generate at least some of the obvious incomplete match warnings.
17031703
let warnOnUnused = false // we can't turn this on since we're pretending all partials fail in order to control the complexity of this.
17041704
let warnOnIncomplete = true
1705-
let clausesPretendAllPartialFail = clausesL |> List.collect (fun (MatchClause(p, whenOpt, tg, m)) -> [MatchClause(erasePartialPatterns p, whenOpt, tg, m)])
1705+
let clausesPretendAllPartialFail = clausesL |> List.collect (fun (MatchClause(p, whenOpt, tg, m)) -> [MatchClause(erasePartialPatterns p, whenOpt, tg, m)])
17061706
let _ = CompilePatternBasic g denv amap tcVal infoReader mExpr mMatch warnOnUnused warnOnIncomplete actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) clausesPretendAllPartialFail inputTy resultTy
17071707
let warnOnIncomplete = false
17081708

0 commit comments

Comments
 (0)