diff options
-rwxr-xr-x | compiler/main.nim | 4 | ||||
-rwxr-xr-x | compiler/semstmts.nim | 2 | ||||
-rw-r--r-- | tests/compile/tnamedparamanonproc.nim | 14 |
3 files changed, 16 insertions, 4 deletions
diff --git a/compiler/main.nim b/compiler/main.nim index fd934e195..0a76b967a 100755 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -312,9 +312,7 @@ proc MainCommand = # no need to write rod files and would slow down things: #registerPass(rodwrite.rodwritePass()) discard CompileModule(options.libpath / "system", {sfSystemModule}) - # I'm lazy and misused this piece of code as a testcase so don't remove - # the invocation with a named parameter: - service.serve(action = proc () = + service.serve(proc () = let projectFile = mainCommandArg() discard CompileModule(projectFile, {sfMainModule}) ) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 5bd8462f3..e3956b918 100755 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -690,7 +690,7 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = if sfImportc in s.flags: LocalError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s) #if efDetermineType notin flags: - # XXX not good enough + # XXX not good enough; see tnamedparamanonproc.nim pushProcCon(c, s) addResult(c, s.typ.sons[0], n.info, skProc) let semBody = hloBody(c, semProcBody(c, n.sons[bodyPos])) diff --git a/tests/compile/tnamedparamanonproc.nim b/tests/compile/tnamedparamanonproc.nim new file mode 100644 index 000000000..272b84e91 --- /dev/null +++ b/tests/compile/tnamedparamanonproc.nim @@ -0,0 +1,14 @@ + +type + PButton = ref object + TButtonClicked = proc(button: PButton) {.nimcall.} + +proc newButton*(onClick: TButtonClicked) = + nil + +proc main() = + newButton(onClick = proc(b: PButton) = + var requestomat = 12 + ) + +main() |