@@ -117,14 +117,14 @@ module internal ProvidedInterface =
117117
118118type internal RecordPropertyMetadata =
119119 { Name : string
120- Alias : string option
120+ Alias : string voption
121121 Description : string option
122122 DeprecationReason : string option
123123 Type : Type }
124124 member x.AliasOrName =
125125 match x.Alias with
126- | Some x -> x
127- | None -> x.Name
126+ | ValueSome x -> x
127+ | ValueNone -> x.Name
128128
129129type internal ProvidedRecordTypeDefinition ( className , baseType ) =
130130 inherit ProvidedTypeDefinition( className, baseType, nonNullable = true )
@@ -157,7 +157,7 @@ module internal ProvidedRecord =
157157 metadata.Description |> Option.iter pdef.AddXmlDoc
158158 metadata.DeprecationReason |> Option.iter pdef.AddObsoleteAttribute
159159 pdef))
160- let addConstructorDelayed ( propertiesGetter : unit -> ( string * string option * Type ) list ) =
160+ let addConstructorDelayed ( propertiesGetter : unit -> ( string * string voption * Type ) list ) =
161161 tdef.AddMembersDelayed( fun _ ->
162162 // We need to build a constructor that takes all optional properties wrapped in another option.
163163 // We need to do this because optional parameters have issues with non-nullable types
@@ -180,7 +180,7 @@ module internal ProvidedRecord =
180180 let properties = propertiesGetter()
181181 let optionalProperties , requiredProperties =
182182 properties
183- |> List.map ( fun ( name , alias , t ) -> Option .defaultValue name alias, t)
183+ |> List.map ( fun ( name , alias , t ) -> ValueOption .defaultValue name alias, t)
184184 |> List.partition ( fun ( _ , t ) -> isOption t)
185185 if explicitOptionalParameters then
186186 let constructorProperties = requiredProperties @ optionalProperties
@@ -380,7 +380,7 @@ module internal ProvidedOperation =
380380 | _ -> t = typeof< Upload>
381381 variables |> Seq.exists ( snd >> existsUploadType [])
382382 let runMethodOverloads : MemberInfo list =
383- let operationName = Option .toObj operationDefinition.Name
383+ let operationName = ValueOption .toObj operationDefinition.Name
384384 methodOverloadDefinitions |> List.map ( fun overloadParameters ->
385385 let variableNames = overloadParameters |> List.map fst |> List.filter ( fun name -> name <> " runtimeContext" )
386386 let invoker ( args : Expr list ) =
@@ -422,7 +422,7 @@ module internal ProvidedOperation =
422422 methodDef.AddXmlDoc( " Executes the operation on the server and fetch its results." )
423423 upcast methodDef)
424424 let asyncRunMethodOverloads : MemberInfo list =
425- let operationName = Option .toObj operationDefinition.Name
425+ let operationName = ValueOption .toObj operationDefinition.Name
426426 methodOverloadDefinitions |> List.map ( fun overloadParameters ->
427427 let variableNames = overloadParameters |> List.map fst |> List.filter ( fun name -> name <> " runtimeContext" )
428428 let invoker ( args : Expr list ) =
@@ -601,7 +601,7 @@ module internal Provider =
601601 | TypeKind.SCALAR when field.Type.Name.IsSome ->
602602 let providedType = TypeMapping.mapScalarType uploadInputTypeName field.Type.Name.Value
603603 { Name = field.Name
604- Alias = None
604+ Alias = ValueNone
605605 Description = field.Description
606606 DeprecationReason = field.DeprecationReason
607607 Type = providedType }
@@ -613,7 +613,7 @@ module internal Provider =
613613 let itype = getSchemaType field.Type
614614 let providedType = resolveProvidedType itype
615615 { Name = field.Name
616- Alias = None
616+ Alias = ValueNone
617617 Description = field.Description
618618 DeprecationReason = field.DeprecationReason
619619 Type = providedType }
@@ -624,7 +624,7 @@ module internal Provider =
624624 | TypeKind.SCALAR when field.Type.Name.IsSome ->
625625 let providedType = TypeMapping.mapScalarType uploadInputTypeName field.Type.Name.Value
626626 { Name = field.Name
627- Alias = None
627+ Alias = ValueNone
628628 Description = field.Description
629629 DeprecationReason = None
630630 Type = providedType }
@@ -636,7 +636,7 @@ module internal Provider =
636636 let itype = getSchemaType field.Type
637637 let providedType = resolveProvidedType itype
638638 { Name = field.Name
639- Alias = None
639+ Alias = ValueNone
640640 Description = field.Description
641641 DeprecationReason = None
642642 Type = providedType }
@@ -798,22 +798,22 @@ module internal Provider =
798798 |> QueryValidationDesignTimeCache.getOrAdd key
799799 |> throwExceptionIfValidationFailed
800800 #endif
801- let operationName : OperationName option =
801+ let operationName : OperationName voption =
802802 match args.[ 2 ] :?> string with
803803 | null | " " ->
804804 let operationDefinitions = queryAst.Definitions |> List.filter ( function OperationDefinition _ -> true | _ -> false )
805805 match operationDefinitions with
806806 | opdef :: _ -> opdef.Name
807807 | _ -> failwith " Error parsing query. Can not choose a default operation: query document has no operation definitions."
808- | x -> Some x
809- let explicitOperationTypeName : TypeName option =
808+ | x -> ValueSome x
809+ let explicitOperationTypeName : TypeName voption =
810810 match args.[ 3 ] :?> string with
811- | null | " " -> None
812- | x -> Some x
811+ | null | " " -> ValueNone
812+ | x -> ValueSome x
813813 let operationDefinition =
814814 queryAst.Definitions
815- |> List.choose ( function OperationDefinition odef -> Some odef | _ -> None )
816- |> List .find ( fun d -> d.Name = operationName)
815+ |> Seq.vchoose ( function OperationDefinition odef -> ValueSome odef | _ -> ValueNone )
816+ |> Seq .find ( fun d -> d.Name = operationName)
817817 let operationAstFields =
818818 let infoMap = queryAst.GetInfoMap()
819819 match infoMap.TryFind( operationName) with
@@ -843,9 +843,9 @@ module internal Provider =
843843 let actualQuery = queryAst.ToQueryString( QueryStringPrintingOptions.IncludeTypeNames) .Replace( " \r\n " , " \n " )
844844 let className =
845845 match explicitOperationTypeName, operationDefinition.Name with
846- | Some name, _ -> name.FirstCharUpper()
847- | None , Some name -> name.FirstCharUpper()
848- | None , None -> " Operation" + actualQuery.MD5Hash()
846+ | ValueSome name, _ -> name.FirstCharUpper()
847+ | ValueNone , ValueSome name -> name.FirstCharUpper()
848+ | ValueNone , ValueNone -> " Operation" + actualQuery.MD5Hash()
849849 let metadata = getOperationMetadata( schemaTypes, uploadInputTypeName, enumProvidedTypes, operationAstFields, operationTypeRef, explicitOptionalParameters)
850850 let operationTypeName : TypeName =
851851 match operationTypeRef.Name with
0 commit comments