* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2) fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim * Note: isNamedTuple is useful in other places, eg #10010 (comment) * move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim * remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
27 lines
444 B
Nim
27 lines
444 B
Nim
discard """
|
|
errormsg: "generic instantiation too nested"
|
|
"""
|
|
|
|
#[
|
|
bug #4766
|
|
see also: tnested_generic_instantiation.nim
|
|
]#
|
|
|
|
proc toString*[T](x: T) =
|
|
for name, value in fieldPairs(x):
|
|
when compiles(toString(value)):
|
|
discard
|
|
toString(value)
|
|
|
|
type
|
|
Plain = ref object
|
|
discard
|
|
|
|
Wrapped[T] = object
|
|
value: T
|
|
|
|
converter toWrapped[T](value: T): Wrapped[T] =
|
|
Wrapped[T](value: value)
|
|
|
|
let result = Plain()
|
|
toString(result)
|