diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 627877cbeb..e977a242ba 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -379,7 +379,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; g: ModuleGraph): PNode = result = newStrNodeT(s, n, g) else: result = newStrNodeT(getStrOrChar(a), n, g) - of mStrToStr: result = a + of mStrToStr: result = newStrNodeT(getStrOrChar(a), n, g) of mEnumToStr: result = newStrNodeT(ordinalValToString(a, g), n, g) of mArrToSeq: result = copyTree(a) diff --git a/tests/distinct/t9322.nim b/tests/distinct/t9322.nim new file mode 100644 index 0000000000..2501d7fc7a --- /dev/null +++ b/tests/distinct/t9322.nim @@ -0,0 +1,12 @@ +discard """ + output: apr +""" + +type Fix = distinct string + +proc `$`(f: Fix): string {.borrow.} + +proc mystr(s: string) = + echo s + +mystr($Fix("apr"))