From ca77423ffc09e92ca17e430bf79c10ae3c1adb63 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Tue, 20 Feb 2024 02:08:16 -0500 Subject: `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. --- tests/types/tissues_types.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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) -- cgit 1.4.1-2-gfad0