mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
render float128 literals (#24182)
fixes #23639 Not sure if these are meant to be supported but it's better than crashing.
This commit is contained in:
@@ -442,6 +442,11 @@ proc atom(g: TSrcGen; n: PNode): string =
|
||||
result = $n.floatVal & "\'f64"
|
||||
else:
|
||||
result = litAux(g, n, (cast[ptr int64](addr(n.floatVal)))[], 8) & "\'f64"
|
||||
of nkFloat128Lit:
|
||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
||||
result = $n.floatVal & "\'f128"
|
||||
else:
|
||||
result = litAux(g, n, (cast[ptr int64](addr(n.floatVal)))[], 8) & "\'f128"
|
||||
of nkNilLit: result = "nil"
|
||||
of nkType:
|
||||
if (n.typ != nil) and (n.typ.sym != nil): result = n.typ.sym.name.s
|
||||
|
||||
@@ -24,6 +24,9 @@ for i, (x, y) in pairs(data):
|
||||
var (a, b) = (1, 2)
|
||||
type
|
||||
A* = object
|
||||
|
||||
var t04 = 1.0'f128
|
||||
t04 = 2.0'f128
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -49,3 +52,7 @@ echoTypedAndUntypedRepr:
|
||||
discard
|
||||
var (a,b) = (1,2)
|
||||
type A* = object # issue #22933
|
||||
|
||||
echoUntypedRepr:
|
||||
var t04 = 1'f128
|
||||
t04 = 2'f128
|
||||
|
||||
Reference in New Issue
Block a user