diff --git a/changelog.md b/changelog.md index 54996ea34..d5f3c8aa9 100644 --- a/changelog.md +++ b/changelog.md @@ -115,6 +115,7 @@ - `macros.newLit` now preserves named vs unnamed tuples; use `-d:nimHasWorkaround14720` to keep old behavior - Add `random.gauss`, that uses the ratio of uniforms method of sampling from a Gaussian distribution. - Add `typetraits.elementType` to get element type of an iterable. +- `typetraits.$`: `$(int,)` is now `"(int,)"`; `$tuple[]` is now `"tuple[]"` ## Language changes - In the newruntime it is now allowed to assign to the discriminator field diff --git a/compiler/types.nim b/compiler/types.nim index b8f58c950..0be0b3eed 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -634,13 +634,14 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = if i < t.n.len - 1: result.add(", ") result.add(']') elif t.len == 0: - result = "tuple" + result = "tuple[]" else: if prefer == preferTypeName: result = "(" else: result = "tuple of (" for i in 0..