We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProcNotation
fun
This is valid code, because parameters of lib funs do not require a name:
lib Foo # first parameter is `x : ::Proc(Int, Int)` # second parameter is ` : Int` fun foo(x : Int -> Int, Int) end
Macro interpolation of the above AST node adds a pair of parentheses around the ProcNotation restriction:
lib Foo fun foo(x : (Int -> Int), Int) # Error: expecting token '->', not ')' end
It appears the parser is expecting another ProcNotation around those types, e.g.:
fun foo(x : (Int -> Int), Int -> Void) # Proc(Proc(Int, Int), Int, Void)
Either the syntax should allow this, or those parentheses should be dropped. This appears in the Bionic bindings and is not a typo:
# src/lib_c/aarch64-android/c/pthread.cr lib LibC fun pthread_create(__pthread_ptr : PthreadT*, __attr : PthreadAttrT*, __start_routine : Void* -> Void*, Void*) : Int end
Related: #11966
The text was updated successfully, but these errors were encountered:
As expected, this applies to normal Calls as well (item 4 on #11966):
Call
macro f(x) {{ x.args.map(&.stringify) }} end f(foo(x : T, U -> V, Foo)) # => ["x : (T, U -> V)", "Foo"] f(foo(x : (T, U -> V), Foo)) # Error: expecting token '->', not ')'
Sorry, something went wrong.
->
Successfully merging a pull request may close this issue.
This is valid code, because parameters of lib funs do not require a name:
Macro interpolation of the above AST node adds a pair of parentheses around the
ProcNotation
restriction:It appears the parser is expecting another
ProcNotation
around those types, e.g.:Either the syntax should allow this, or those parentheses should be dropped. This appears in the Bionic bindings and is not a typo:
Related: #11966
The text was updated successfully, but these errors were encountered: