Skip to content

Commit fe79153

Browse files
valbersxperiandri
authored andcommitted
fix(376): rec func "go" was misintrepreting param "ms" (middlewares)
Issue found while trying to run the Star Wars API sample. Somehow, in the pattern matching branch "None -> go ctx ms", "go" was being reevaluated to be a function whose ctx parameter is of type unit and the 'res type of the containing function runMiddlewares was being reevaluated to be IExecutorMiddleware (something like a parameterless ExecutorMiddleware fetcher), although ctx was clearly initially set to be a SchemaCompileContext and 'res a "unit" because of the type of the "compileSchema" function passed as parameter in a later function call. However, ms is always supposed to be a list of middlewares yet it was being defined as a generic list, more specifically: the type definition was implicit. By adding an explicit hint to the compiler in the code that "m" is an IExecutorMiddleware (and therefore "ms" a list thereof), the compiler no longer had a misinterpretation issue with the recursive "go" function and the Star Wars API sample now starts successfully.
1 parent ad36264 commit fe79153

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FSharp.Data.GraphQL.Server/Executor.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware s
7676
: 'res =
7777
let rec go ctx = function
7878
| [] -> onComplete ctx
79-
| m :: ms ->
79+
| m : IExecutorMiddleware :: ms ->
8080
match (phaseSel m) with
8181
| Some f -> f ctx (fun ctx' -> go ctx' ms)
8282
| None -> go ctx ms

0 commit comments

Comments
 (0)