@@ -43,21 +43,23 @@ let TryFindIntrinsicOrExtensionMethInfo collectionSettings (cenv: cenv) (env: Tc
4343/// Ignores an attribute
4444let IgnoreAttribute _ = None
4545
46+ [<return : Struct>]
4647let (| ExprAsPat | _ |) ( f : SynExpr ) =
4748 match f with
4849 | SingleIdent v1
49- | SynExprParen( SingleIdent v1, _, _, _) -> Some ( mkSynPatVar None v1)
50+ | SynExprParen( SingleIdent v1, _, _, _) -> ValueSome ( mkSynPatVar None v1)
5051 | SynExprParen( SynExpr.Tuple( false , elems, commas, _), _, _, _) ->
5152 let elems = elems |> List.map (| SingleIdent|_|)
5253
5354 if elems |> List.forall ( fun x -> x.IsSome) then
54- Some ( SynPat.Tuple( false , ( elems |> List.map ( fun x -> mkSynPatVar None x.Value)), commas, f.Range))
55+ ValueSome ( SynPat.Tuple( false , ( elems |> List.map ( fun x -> mkSynPatVar None x.Value)), commas, f.Range))
5556 else
56- None
57- | _ -> None
57+ ValueNone
58+ | _ -> ValueNone
5859
5960// For join clauses that join on nullable, we syntactically insert the creation of nullable values on the appropriate side of the condition,
6061// then pull the syntax apart again
62+ [<return : Struct>]
6163let (| JoinRelation | _ |) cenv env ( expr : SynExpr ) =
6264 let m = expr.Range
6365 let ad = env.eAccessRights
@@ -79,27 +81,27 @@ let (|JoinRelation|_|) cenv env (expr: SynExpr) =
7981 | _ -> false
8082
8183 match expr with
82- | BinOpExpr( opId, a, b) when isOpName opNameEquals cenv.g.equals_ operator_ vref opId.idText -> Some ( a, b)
84+ | BinOpExpr( opId, a, b) when isOpName opNameEquals cenv.g.equals_ operator_ vref opId.idText -> ValueSome ( a, b)
8385
8486 | BinOpExpr( opId, a, b) when isOpName opNameEqualsNullable cenv.g.equals_ nullable_ operator_ vref opId.idText ->
8587
8688 let a =
8789 SynExpr.App( ExprAtomicFlag.Atomic, false , mkSynLidGet a.Range [ MangledGlobalName; " System" ] " Nullable" , a, a.Range)
8890
89- Some ( a, b)
91+ ValueSome ( a, b)
9092
9193 | BinOpExpr( opId, a, b) when isOpName opNameNullableEquals cenv.g.nullable_ equals_ operator_ vref opId.idText ->
9294
9395 let b =
9496 SynExpr.App( ExprAtomicFlag.Atomic, false , mkSynLidGet b.Range [ MangledGlobalName; " System" ] " Nullable" , b, b.Range)
9597
96- Some ( a, b)
98+ ValueSome ( a, b)
9799
98100 | BinOpExpr( opId, a, b) when isOpName opNameNullableEqualsNullable cenv.g.nullable_ equals_ nullable_ operator_ vref opId.idText ->
99101
100- Some ( a, b)
102+ ValueSome ( a, b)
101103
102- | _ -> None
104+ | _ -> ValueNone
103105
104106let elimFastIntegerForLoop ( spFor , spTo , id , start : SynExpr , dir , finish : SynExpr , innerExpr , m : range ) =
105107 let mOp = ( unionRanges start.Range finish.Range) .MakeSynthetic()
@@ -179,7 +181,7 @@ let YieldFree (cenv: cenv) expr =
179181/// Determine if a syntactic expression inside 'seq { ... }' or '[...]' counts as a "simple sequence
180182/// of semicolon separated values". For example [1;2;3].
181183/// 'acceptDeprecated' is true for the '[ ... ]' case, where we allow the syntax '[ if g then t else e ]' but ask it to be parenthesized
182- ///
184+ [< return : Struct>]
183185let (| SimpleSemicolonSequence | _ |) cenv acceptDeprecated cexpr =
184186
185187 let IsSimpleSemicolonSequenceElement expr =
@@ -207,12 +209,12 @@ let (|SimpleSemicolonSequence|_|) cenv acceptDeprecated cexpr =
207209 if IsSimpleSemicolonSequenceElement e1 then
208210 TryGetSimpleSemicolonSequenceOfComprehension e2 ( e1 :: acc)
209211 else
210- None
212+ ValueNone
211213 | _ ->
212214 if IsSimpleSemicolonSequenceElement expr then
213- Some ( List.rev ( expr :: acc))
215+ ValueSome ( List.rev ( expr :: acc))
214216 else
215- None
217+ ValueNone
216218
217219 TryGetSimpleSemicolonSequenceOfComprehension cexpr []
218220
0 commit comments