Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 12b1a55

Browse files
authored
Generate arguments in the correct order (#1102)
* Generate arguments in the correct order. * Edit comment.
1 parent c4e6b72 commit 12b1a55

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/QsCompiler/CSharpGeneration/EntryPoint.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ let private qirArguments parameters parseResult =
200200
|> qirArgumentValue param.QSharpType
201201
|> Option.map (fun value -> ``new`` (ident argumentType) ``(`` [ literal param.Name; value ] ``)``)
202202

203+
// N.B. The parameters sequence is in the right order when it is used here.
204+
// It has to be reversed here because the fold changes the order of the expression syntax.
205+
// This is a problem because the API for QIR submission expects the list of arguments in order.
203206
parameters
207+
|> Seq.rev
204208
|> Seq.fold (fun state param -> Option.map2 (fun xs x -> x :: xs) state (argument param)) (Some [])
205209
|> Option.map (fun args -> ident listType <.> (sprintf "Create<%s>" argumentType |> ident, args))
206210

0 commit comments

Comments
 (0)