Skip to content

Commit

Permalink
remove exception (#18906)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Oct 22, 2021
1 parent d634587 commit 4d81080
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 1 addition & 7 deletions compiler/semfold.nim
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; idgen: IdGenerator; g: ModuleGraph): P
else: result = newStrNodeT("true", n, g)
of mFloatToStr: result = newStrNodeT($getFloat(a), n, g)
of mCStrToStr, mCharToStr:
if a.kind == nkBracket:
var s = ""
for b in a.sons:
s.add b.getStrOrChar
result = newStrNodeT(s, n, g)
else:
result = newStrNodeT(getStrOrChar(a), n, g)
result = newStrNodeT(getStrOrChar(a), n, g)
of mStrToStr: result = newStrNodeT(getStrOrChar(a), n, g)
of mEnumToStr: result = newStrNodeT(ordinalValToString(a, g), n, g)
of mArrToSeq:
Expand Down
7 changes: 7 additions & 0 deletions tests/system/tdollars.nim
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,12 @@ proc main()=
test2 high(int8), "127"
test2 low(int8), "-128"

block:
const
a: array[3, char] = ['N', 'i', 'm']
aStr = $(a)

doAssert aStr == """['N', 'i', 'm']"""

static: main()
main()

0 comments on commit 4d81080

Please sign in to comment.