Fix #5127
This commit is contained in:
parent
8f4b374327
commit
16eb4b1fee
5 changed files with 60 additions and 32 deletions
22
tests/concepts/twrapconcept.nim
Normal file
22
tests/concepts/twrapconcept.nim
Normal file
|
|
@ -0,0 +1,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"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue