flyx / NimYAML

YAML implementation for Nim
https://nimyaml.org
Other
186 stars 36 forks source link

defaultVal is not observed on stropped names #116

Closed sungchulTW closed 1 year ago

sungchulTW commented 2 years ago

type PathDocument = ref object $ref {.defaultVal: none(string).}: Option[string] others {.defaultVal: none(string).}: Option[string]

Hello. First of all, Thank you for your awesome package! While I am using NimYAML, I observed the above object always get missing '$ref' error dispite the fact that I already set the defaultVal.

Is this a known issue?

Thank you.

flyx commented 2 years ago

Can reproduce. Seems to be a compiler bug, created a Nim issue.

A workaround would be:

type PathDocument {.sparse.} = ref object
  `$ref`: Option[string]
  others: Option[string]
flyx commented 1 year ago

Has been fixed in Nim compiler.