-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
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
Default procedure parameters are untyped #12942
Labels
Comments
PR welcome
The sempass doesn't replace idents with syms while it should. Changes to |
Araq
pushed a commit
that referenced
this issue
Sep 27, 2024
…24191) Reverts #24184, reopens #12942, reopens #19118 #24184 seems to have caused a regression in https://github.com/c-blake/thes and https://github.com/c-blake/bu/blob/main/rp.nim#L84 reproducible with `git clone https://github.com/c-blake/cligen; git clone https://github.com/c-blake/thes; cd thes; nim c -p=../cligen thes`. Changing the `const` to `let` makes it compile. A minimization that is probably the same issue is: ```nim const a: seq[string] = @[] proc foo(x = a) = echo typeof(x) echo x import macros macro resemFoo() = result = getImpl(bindSym"foo") block: resemFoo() # Error: cannot infer the type of parameter 'x' ``` This should be a regression test in a future reimplementation of #24184.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, default parameters of procedures are not checked semantically (
typed
), which causes problems eg. when you want to get their type. Nim does not provide another mechanism of getting the type of a default parameter of a proc,getType
andgetTypeInst
are the only way, but (obviously) they expectnnkSym
as their parameter node's kind.Example
Current Output
Expected Output
Possible Solution
Additional Information
The text was updated successfully, but these errors were encountered: