@@ -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
207207let 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
404404let 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
931931and erasePartials inps =
932932 List.map erasePartialPatterns inps
933-
933+
934934let 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