Never convert Preserves symbols to Nim strings!

This commit is contained in:
Emery Hemingway 2023-07-20 18:26:11 +01:00
parent 9fa6685071
commit 47e7851beb
2 changed files with 2 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "20230612"
version = "20230720"
author = "Emery Hemingway"
description = "data model and serialization format"
license = "Unlicense"

View File

@ -1057,15 +1057,9 @@ proc fromPreserve*[T, E](v: var T; pr: Preserve[E]): bool =
v = (T)pr.int
result = true
elif T is string:
case pr.kind
of pkString:
if pr.kind == pkString:
v = pr.string
result = true
of pkSymbol:
# loose convertability of Preserves symbol to Nim string
v = string pr.symbol
result = true
else: discard
elif T is Symbol:
if pr.kind == pkSymbol:
v = pr.symbol