-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
require untyped macros/templates to match before early expansion in g…
…enerics fixes #22740
- Loading branch information
Showing
2 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
block: # issue #22740 | ||
macro foo(n: untyped): untyped = discard | ||
# Remove this macro to fix the problem | ||
macro foo(n, n2: untyped): untyped = discard | ||
|
||
# This one is fine | ||
proc test1(v: string) = | ||
foo >"test1" | ||
|
||
# This one fails to compile | ||
proc test2[T](v: T) = | ||
foo >"test2" | ||
|
||
test1("hello") | ||
test2("hello") | ||
|
||
block: # above simplified (yes this errored) | ||
proc foo[T]() = | ||
when false: | ||
>1 | ||
foo[int]() |