twrapconcept.nim 385 B

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