summary refs log tree commit diff stats
path: root/tests/concepts/twrapconcept.nim
blob: 377b63afeca0bd619ecbbec39d2f891d3f015c0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  errormsg: "type mismatch: got <string>"
  line: 21
  nimout: "twrapconcept.nim(11, 5) Foo: concept predicate failed"
"""

# https://github.com/nim-lang/Nim/issues/5127

type
  Foo = concept foo
    foo.get is int

  FooWrap[F: Foo] = object
    foo: F

proc get(x: int): int = x

proc wrap[F: Foo](foo: F): FooWrap[F] = FooWrap[F](foo: foo)

let x = wrap(12)
let y = wrap "string"