Skip to content

Commit 79e8669

Browse files
committed
bugfix: sysTypeFromName("float64") was never cached
1 parent e31ef59 commit 79e8669

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/magicsys.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ proc getSysType*(g: ModuleGraph; info: TLineInfo; kind: TTypeKind): PType =
6868
of tyUInt64: result = sysTypeFromName("uint64")
6969
of tyFloat: result = sysTypeFromName("float")
7070
of tyFloat32: result = sysTypeFromName("float32")
71-
of tyFloat64: return sysTypeFromName("float64")
71+
of tyFloat64: result = sysTypeFromName("float64")
7272
of tyFloat128: result = sysTypeFromName("float128")
7373
of tyBool: result = sysTypeFromName("bool")
7474
of tyChar: result = sysTypeFromName("char")
@@ -79,7 +79,9 @@ proc getSysType*(g: ModuleGraph; info: TLineInfo; kind: TTypeKind): PType =
7979
else: internalError(g.config, "request for typekind: " & $kind)
8080
g.sysTypes[kind] = result
8181
if result.kind != kind:
82-
internalError(g.config, "wanted: " & $kind & " got: " & $result.kind)
82+
if kind == tyFloat64 and result.kind == tyFloat: discard # because of aliasing
83+
else:
84+
internalError(g.config, "wanted: " & $kind & " got: " & $result.kind)
8385
if result == nil: internalError(g.config, "type not found: " & $kind)
8486

8587
proc resetSysTypes*(g: ModuleGraph) =

0 commit comments

Comments
 (0)