diff options
author | Ryan McConnell <rammcconnell@gmail.com> | 2024-02-20 02:08:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 08:08:16 +0100 |
commit | ca77423ffc09e92ca17e430bf79c10ae3c1adb63 (patch) | |
tree | 08ea830c1ff141c8928c0f2fbd01f6fea3f9ac87 /tests | |
parent | 7bf8cd3f8654c152b87052e28c515e525b43b38c (diff) | |
download | Nim-ca77423ffc09e92ca17e430bf79c10ae3c1adb63.tar.gz |
`varargs[typed]` should behave more like `typed` (#23303)
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. ```nim template s(d: typed)=discard proc something()=discard proc something(x:int)=discard s(something) ``` ```nim 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: ```nim template s(a: varargs[typed])=discard proc something()=discard proc something(x:int)=discard s: something ``` also, this works: ```nim 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: ```nim 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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/types/tissues_types.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/types/tissues_types.nim b/tests/types/tissues_types.nim index 49c6d85ee..6bb1258f4 100644 --- a/tests/types/tissues_types.nim +++ b/tests/types/tissues_types.nim @@ -106,3 +106,13 @@ block: let t = Foo[float](x1: 1) doAssert t.x1 == 1 +block: + template s(d: varargs[typed])=discard + + proc something(x:float)=discard + proc something(x:int)=discard + proc otherthing()=discard + + s(something) + s(otherthing, something) + s(something, otherthing) |