twrapconcept.nim 398 B

1234567891011121314151617181920212223
  1. discard """
  2. errormsg: "type mismatch: got (string)"
  3. line: 21
  4. nimout: "twrapconcept.nim(11, 5) Foo: concept predicate failed"
  5. """
  6. # https://github.com/nim-lang/Nim/issues/5127
  7. type
  8. Foo = concept foo
  9. foo.get is int
  10. FooWrap[F: Foo] = object
  11. foo: F
  12. proc get(x: int): int = x
  13. proc wrap[F: Foo](foo: F): FooWrap[F] = FooWrap[F](foo: foo)
  14. let x = wrap(12)
  15. let y = wrap "string"