Nim
Nim copied to clipboard
Emtpy `nnkTupleConstr` fails in `type` declaration
Description
import macros
macro works(): typedesc =
nnkTupleConstr.newTree(ident"ValueError")
macro fails(): typedesc =
nnkTupleConstr.newTree()
type
A[T] = object
B = A[works()]
C = A[type(())]
D = A[fails()]
Nim Version
1.6.14
Current Output
testit.nim(15, 14) template/generic instantiation of `fails` from here
Nim/lib/core/macros.nim(680, 22) Error: type expected
Expected Output
No response
Possible Solution
No response
Additional Information
No response
Perhaps we should allow empty tuple types constructed in parentheses:
var x: ()
After all
var x: tuple[]
compiles