summary refs log tree commit diff stats
path: root/tests/ccgbugs/tborrowmagic.nim
Commit message (Collapse)AuthorAgeFilesLines
* Fix semantic pass with borrowed magic procs (#8945)LemonBoy2018-09-111-0/+8
Reported by pqflx3 on the forum.
27 28 29 30
discard """
  output: "(kind: None)"
"""

when true:
  # bug #2637

  type
    OptionKind = enum
      None,
      Some

    Option*[T] = object
      case kind: OptionKind
      of None:
        discard
      of Some:
        value*: T

  proc none*[T](): Option[T] =
    Option[T](kind: None)

  proc none*(T: typedesc): Option[T] = none[T]()


  proc test(): Option[int] =
    int.none

  echo test()