Skip to content
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

varargs[typed] should behave more like typed #23303

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

Graveflo
Copy link
Contributor

This fixes an oversight with a change that I made a while ago.

Basically, these two snippets should both compile. Currently the varargs version will fail.

template s(d: typed)=discard
proc something()=discard
proc something(x:int)=discard

s(something)
template s(d: varargs[typed])=discard
proc something()=discard
proc something(x:int)=discard

s(something)

Potentially unrelated, but this works currently for some reason:

template s(a: varargs[typed])=discard
proc something()=discard
proc something(x:int)=discard

s:
  something

also, this works:

template s(b:untyped, a: varargs[typed])=discard
proc something()=discard
proc something(x:int)=discard

s (g: int):
  something

but this doesn't, and the error message is not what I would expect:

template s(b:untyped, a: varargs[typed])=discard
proc something()=discard
proc something(x:int)=discard

s (g: int), something

So far as I can tell, none of these issues persist for me after the code changes in this PR.

@Graveflo Graveflo marked this pull request as draft February 12, 2024 17:10
@Graveflo
Copy link
Contributor Author

I was a bit lost putting this together. With the varargs ast spec and implicitConv. I also think that actingF = f[0] should be actingF = f.base but I don't want to re-run the CI just for that.

@Graveflo Graveflo marked this pull request as ready for review February 16, 2024 17:29
@Araq Araq merged commit ca77423 into nim-lang:devel Feb 20, 2024
19 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from ca77423

Hint: mm: orc; opt: speed; options: -d:release
178022 lines; 7.484s; 769.098MiB peakmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants