Skip to content

Commit b1ada6c

Browse files
committed
fix: fixes #33: bypass nim#23936
1 parent 3a15430 commit b1ada6c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/pylib/numTypes/floats/parsefloat.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ func parsePyFloat*(a: openArray[char], res: var BiggestFloat): int =
1010
if a.len == 0: return 0
1111
result = a.parse_inf_or_nan(res)
1212
if result != 0: return
13-
result = parseFloat(a, res)
13+
when nimvm:
14+
# NIM-BUG: https://github.com/nim-lang/Nim/issues/23936
15+
# bypass
16+
result = parseFloat(a.toOpenArray(0, a.high), res)
17+
else:
18+
result = parseFloat(a, res)

tests/tcomplex.nim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ suite "complex":
8181
check(complex(imag=1.5), 0.0, 1.5)
8282
check(complex(real=4.25, imag=1.5), 4.25, 1.5)
8383
check(complex(4.25, imag=1.5), 4.25, 1.5)
84+
test "literals":
85+
check 1-3'j == complex(1, -3)
86+
checkpoint "at compile-time"
87+
const c = -3-1'j
88+
check c.real == -3
89+
check c.imag == -1
8490
test "str":
8591
let z = complex(3.0, -4.0)
8692
check $z == "(3-4j)"

0 commit comments

Comments
 (0)