flyx / NimYAML

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

RT vs CT: intVal nim VM bug #92

Closed timotheecour closed 3 years ago

timotheecour commented 3 years ago

(with https://github.com/nim-lang/Nim/pull/15947)

example 1: works at RT, nim bug at CT

when defined case5f:
  #[
  Error: unhandled exception: 'intVal' is not accessible using discriminant 'kind' of type 'TFullReg' [FieldDefect]
  ]#
  import yaml
  type
    Node = ref object
      name1: string
      lhs: Node
      rhs: Node
  proc main =
    let input = """
{
  name1: A,
  lhs: &ref1 {
    name1: B,
    lhs: *ref1,
    rhs: ~
  },
  rhs: *ref1
}
"""
    var root = loadAs[Node](input)
    echo root.name1
    echo root.lhs.name1
    echo root.rhs.lhs.lhs.name1
  static: main()
  main()
timotheecour commented 3 years ago

@flyx after the last commit in https://github.com/nim-lang/Nim/pull/15947

https://github.com/nim-lang/Nim/pull/15947/commits/4975608ae8d89fb065c59608d49b4c95eaa33d46 fix in opcCastIntToPtr (fixes flyx/NimYAML#92)

this now works, showing nimyaml anchors do work in CT:

this prints: A B B

at both RT and CT