mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-08 21:48:40 +00:00
Fix another test
This commit is contained in:
@@ -2075,6 +2075,8 @@ module internal ArgParseHelpers_ConsumePlugin =
|
|||||||
let positionalConsumers = ResizeArray<string> ()
|
let positionalConsumers = ResizeArray<string> ()
|
||||||
|
|
||||||
let arg0 : Choice<string, string> list =
|
let arg0 : Choice<string, string> list =
|
||||||
|
positionalConsumers.Add (sprintf "--%s" "args")
|
||||||
|
|
||||||
positionals
|
positionals
|
||||||
|> List.map (fun x ->
|
|> List.map (fun x ->
|
||||||
match x with
|
match x with
|
||||||
@@ -2927,6 +2929,8 @@ module internal ArgParseHelpers_ConsumePlugin =
|
|||||||
Unchecked.defaultof<_>
|
Unchecked.defaultof<_>
|
||||||
|
|
||||||
let arg1 : Choice<string, string> list =
|
let arg1 : Choice<string, string> list =
|
||||||
|
positionalConsumers.Add (sprintf "--%s" "grab-everything")
|
||||||
|
|
||||||
positionals
|
positionals
|
||||||
|> List.map (fun x ->
|
|> List.map (fun x ->
|
||||||
match x with
|
match x with
|
||||||
@@ -3142,6 +3146,8 @@ module internal ArgParseHelpers_ConsumePlugin =
|
|||||||
Unchecked.defaultof<_>
|
Unchecked.defaultof<_>
|
||||||
|
|
||||||
let arg1 : Choice<int, int> list =
|
let arg1 : Choice<int, int> list =
|
||||||
|
positionalConsumers.Add (sprintf "--%s" "grab-everything")
|
||||||
|
|
||||||
positionals
|
positionals
|
||||||
|> List.map (fun x ->
|
|> List.map (fun x ->
|
||||||
match x with
|
match x with
|
||||||
|
@@ -87,6 +87,9 @@ type private ParseFunction<'acc> =
|
|||||||
|
|
||||||
module internal ShibaGenerator =
|
module internal ShibaGenerator =
|
||||||
//let log (s : string) = System.IO.File.AppendAllText ("/tmp/myriad.log", s + "\n")
|
//let log (s : string) = System.IO.File.AppendAllText ("/tmp/myriad.log", s + "\n")
|
||||||
|
let private choice1Of2 = SynExpr.createIdent "Choice1Of2"
|
||||||
|
let private choice2Of2 = SynExpr.createIdent "Choice2Of2"
|
||||||
|
|
||||||
type RecognisedType =
|
type RecognisedType =
|
||||||
| Union of UnionType
|
| Union of UnionType
|
||||||
| Record of RecordType
|
| Record of RecordType
|
||||||
@@ -1064,51 +1067,56 @@ module internal ShibaGenerator =
|
|||||||
failwith
|
failwith
|
||||||
"internal error: positional args, if Choicey, should be a ChoicePositional"
|
"internal error: positional args, if Choicey, should be a ChoicePositional"
|
||||||
| Accumulation.ChoicePositional attrContents ->
|
| Accumulation.ChoicePositional attrContents ->
|
||||||
SynExpr.createIdent "positionals"
|
[
|
||||||
|> SynExpr.pipeThroughFunction (
|
SynExpr.callMethodArg
|
||||||
SynExpr.applyFunction
|
"Add"
|
||||||
(SynExpr.createLongIdent [ "List" ; "map" ])
|
leaf.HumanReadableArgForm
|
||||||
(SynExpr.createLambda
|
(SynExpr.createIdent "positionalConsumers")
|
||||||
"x"
|
SynExpr.createIdent "positionals"
|
||||||
(SynExpr.createMatch
|
|> SynExpr.pipeThroughFunction (
|
||||||
(SynExpr.createIdent "x")
|
SynExpr.applyFunction
|
||||||
[
|
(SynExpr.createLongIdent [ "List" ; "map" ])
|
||||||
SynMatchClause.create
|
(SynExpr.createLambda
|
||||||
(SynPat.identWithArgs
|
"x"
|
||||||
[ Ident.create "Choice1Of2" ]
|
(SynExpr.createMatch
|
||||||
(SynArgPats.create
|
(SynExpr.createIdent "x")
|
||||||
[
|
[
|
||||||
SynPat.tuple
|
SynMatchClause.create
|
||||||
[
|
(SynPat.identWithArgs
|
||||||
SynPat.named "x"
|
[ Ident.create "Choice1Of2" ]
|
||||||
SynPat.named "argPos"
|
(SynArgPats.create
|
||||||
]
|
[
|
||||||
]))
|
SynPat.tuple
|
||||||
(SynExpr.applyFunction
|
[
|
||||||
leaf.ParseFn
|
SynPat.named "x"
|
||||||
(SynExpr.createIdent "x")
|
SynPat.named "argPos"
|
||||||
|> SynExpr.pipeThroughFunction (
|
]
|
||||||
SynExpr.createIdent "Choice1Of2"
|
]))
|
||||||
))
|
(SynExpr.applyFunction
|
||||||
SynMatchClause.create
|
leaf.ParseFn
|
||||||
(SynPat.identWithArgs
|
(SynExpr.createIdent "x")
|
||||||
[ Ident.create "Choice2Of2" ]
|
|> SynExpr.pipeThroughFunction choice1Of2)
|
||||||
(SynArgPats.create
|
SynMatchClause.create
|
||||||
[
|
(SynPat.identWithArgs
|
||||||
SynPat.tuple
|
[ Ident.create "Choice2Of2" ]
|
||||||
[
|
(SynArgPats.create
|
||||||
SynPat.named "x"
|
[
|
||||||
SynPat.named "argPos"
|
SynPat.tuple
|
||||||
]
|
[
|
||||||
]))
|
SynPat.named "x"
|
||||||
(SynExpr.applyFunction
|
SynPat.named "argPos"
|
||||||
leaf.ParseFn
|
]
|
||||||
(SynExpr.createIdent "x")
|
]))
|
||||||
|> SynExpr.pipeThroughFunction (
|
(SynExpr.applyFunction
|
||||||
SynExpr.createIdent "Choice2Of2"
|
leaf.ParseFn
|
||||||
))
|
(SynExpr.createIdent "x")
|
||||||
]))
|
|> SynExpr.pipeThroughFunction (
|
||||||
)
|
SynExpr.createIdent "Choice2Of2"
|
||||||
|
))
|
||||||
|
]))
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|> SynExpr.sequential
|
||||||
| _ -> failwith "unexpected: positional arguments should be a list"
|
| _ -> failwith "unexpected: positional arguments should be a list"
|
||||||
| None ->
|
| None ->
|
||||||
|
|
||||||
@@ -1158,9 +1166,7 @@ module internal ShibaGenerator =
|
|||||||
(SynPat.identWithArgs
|
(SynPat.identWithArgs
|
||||||
[ Ident.create "Some" ]
|
[ Ident.create "Some" ]
|
||||||
(SynArgPats.create [ SynPat.named "result" ]))
|
(SynArgPats.create [ SynPat.named "result" ]))
|
||||||
(SynExpr.applyFunction
|
(SynExpr.applyFunction choice1Of2 (SynExpr.createIdent "result"))
|
||||||
(SynExpr.createIdent "Choice1Of2")
|
|
||||||
(SynExpr.createIdent "result"))
|
|
||||||
SynMatchClause.create
|
SynMatchClause.create
|
||||||
(SynPat.identWithArgs [ Ident.create "None" ] (SynArgPats.create []))
|
(SynPat.identWithArgs [ Ident.create "None" ] (SynArgPats.create []))
|
||||||
(match choice with
|
(match choice with
|
||||||
@@ -1175,7 +1181,7 @@ module internal ShibaGenerator =
|
|||||||
name.idText
|
name.idText
|
||||||
(SynExpr.createIdent' record.Original.Name)
|
(SynExpr.createIdent' record.Original.Name)
|
||||||
|> SynExpr.paren
|
|> SynExpr.paren
|
||||||
|> SynExpr.applyFunction (SynExpr.createIdent "Choice2Of2"))
|
|> SynExpr.applyFunction choice2Of2)
|
||||||
]
|
]
|
||||||
|> SynExpr.createMatch (SynExpr.dotGet ident.idText (SynExpr.createIdent "this"))
|
|> SynExpr.createMatch (SynExpr.dotGet ident.idText (SynExpr.createIdent "this"))
|
||||||
| Accumulation.List acc ->
|
| Accumulation.List acc ->
|
||||||
@@ -1755,7 +1761,7 @@ module internal ShibaGenerator =
|
|||||||
SynExpr.sequential
|
SynExpr.sequential
|
||||||
[
|
[
|
||||||
SynExpr.tuple [ SynExpr.createIdent "arg" ; SynExpr.createIdent "argNum_" ]
|
SynExpr.tuple [ SynExpr.createIdent "arg" ; SynExpr.createIdent "argNum_" ]
|
||||||
|> SynExpr.pipeThroughFunction (SynExpr.createIdent "Choice1Of2")
|
|> SynExpr.pipeThroughFunction choice1Of2
|
||||||
|> SynExpr.pipeThroughFunction (SynExpr.createLongIdent' [ leftoverArgs ; Ident.create "Add" ])
|
|> SynExpr.pipeThroughFunction (SynExpr.createLongIdent' [ leftoverArgs ; Ident.create "Add" ])
|
||||||
|
|
||||||
recurseKey
|
recurseKey
|
||||||
@@ -1878,7 +1884,7 @@ module internal ShibaGenerator =
|
|||||||
let onFailure =
|
let onFailure =
|
||||||
[
|
[
|
||||||
SynExpr.tuple [ SynExpr.createIdent "key" ; SynExpr.createIdent "argNum_" ]
|
SynExpr.tuple [ SynExpr.createIdent "key" ; SynExpr.createIdent "argNum_" ]
|
||||||
|> SynExpr.pipeThroughFunction (SynExpr.createIdent "Choice1Of2")
|
|> SynExpr.pipeThroughFunction choice1Of2
|
||||||
|> SynExpr.pipeThroughFunction (SynExpr.createLongIdent' [ leftoverArgs ; Ident.create "Add" ])
|
|> SynExpr.pipeThroughFunction (SynExpr.createLongIdent' [ leftoverArgs ; Ident.create "Add" ])
|
||||||
|
|
||||||
SynExpr.createIdent "go"
|
SynExpr.createIdent "go"
|
||||||
@@ -1990,9 +1996,7 @@ module internal ShibaGenerator =
|
|||||||
]))
|
]))
|
||||||
)
|
)
|
||||||
|> SynExpr.pipeThroughFunction (
|
|> SynExpr.pipeThroughFunction (
|
||||||
SynExpr.applyFunction
|
SynExpr.applyFunction (SynExpr.createLongIdent [ "Seq" ; "map" ]) choice2Of2
|
||||||
(SynExpr.createLongIdent [ "Seq" ; "map" ])
|
|
||||||
(SynExpr.createIdent "Choice2Of2")
|
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
(SynExpr.createIdent' leftoverArgs))
|
(SynExpr.createIdent' leftoverArgs))
|
||||||
|
Reference in New Issue
Block a user