NimYAML icon indicating copy to clipboard operation
NimYAML copied to clipboard

defaultVal is not observed on stropped names

Open sungchulTW opened this issue 3 years ago • 1 comments
trafficstars

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.

sungchulTW avatar Jul 20 '22 11:07 sungchulTW

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 avatar Jul 20 '22 19:07 flyx

Has been fixed in Nim compiler.

flyx avatar Mar 10 '23 19:03 flyx