view service/rfid_pn532/option_test.nim @ 1310:68e172d9791e

add missing files for the record Ignore-this: 8541c95ef1644cf85b311259602d2892 darcs-hash:1e575d63deb747c9c320daa32f27f0ce93621afb
author drewp <drewp@bigasterisk.com>
date Sun, 21 Apr 2019 03:28:21 -0700
parents
children
line wrap: on
line source

import options

type
  Base = ref object of RootObj
  A = ref object of Base
  B = ref object of Base
    opt: Option[A]

proc `==`(x: A, y: B): bool = false

proc initA(): A =
  new result

proc initB(): B =
  new result
  result.opt = none(A)
  echo "saved none"

let x = initB()
assert x.opt.isNone()