You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
passing a block as last argument doesn't work with optional params.
This is a common use case; fixing this would simplify a lot of code.
Example
templatefun*(a =1, b =2, body: untyped) =discardfun(a =1, 2): discardfun(3, 4): discardfun(b =5, a =6): discardfun(a =1, body =1)
fun(a =1, body =block:
discard)
fun(a =1): discard# CT errorfun(): discard# CT errortemplatefun2*(a =1, b =2, body: untyped): untyped= (a, b)
let c =fun2(1,2): discardlet c2 =fun2(1): discard# CT error
Current Output
Error: type mismatch: got <a: int literal(1), void>
but expected one of:
template fun(a = 1; b = 2; body: untyped)
first type mismatch at position: 2
required type for b: int
but expression '
discard' is of type: void
expression: fun(a = 1):
discard
fun(a = 1): discard # CT error
^
timotheecour
changed the title
passing a block as last argument doesn't work with optional params
optional params don't work with block argument(s) in last position
Nov 13, 2020
passing a block as last argument doesn't work with optional params.
This is a common use case; fixing this would simplify a lot of code.
Example
Current Output
Expected Output
should work
Possible Solution
Additional Information
links
The text was updated successfully, but these errors were encountered: