Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Emtpy `nnkTupleConstr` fails in `type` declaration

Open arnetheduck opened this issue 2 years ago • 1 comments

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

arnetheduck avatar Oct 24 '23 10:10 arnetheduck

Perhaps we should allow empty tuple types constructed in parentheses:

var x: ()

After all

var x: tuple[]

compiles

ringabout avatar Oct 24 '23 11:10 ringabout