Skip to content

Commit

Permalink
remove exception (#18906)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4d81080)
  • Loading branch information
ringabout authored and narimiran committed Apr 24, 2023
1 parent a5a2c57 commit 2f247ed
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 2f247ed

Please sign in to comment.