support for external types with covariant generic params
This commit is contained in:
parent
2a34552596
commit
5e368f3639
8 changed files with 62 additions and 3 deletions
26
tests/errmsgs/tinvalidinout.nim
Normal file
26
tests/errmsgs/tinvalidinout.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
discard """
|
||||
cmd: "nim check $file"
|
||||
errormsg: "`in` and `out` flags can be used only with imported types"
|
||||
nimout: '''
|
||||
tinvalidinout.nim(14, 7) Error: `in` and `out` flags can be used only with imported types
|
||||
tinvalidinout.nim(17, 9) Error: `in` and `out` flags can be used only with imported types
|
||||
tinvalidinout.nim(18, 9) Error: `in` and `out` flags can be used only with imported types
|
||||
'''
|
||||
"""
|
||||
|
||||
type
|
||||
Foo {.header: "foo.h", importcpp.} [in T] = object
|
||||
|
||||
Bar[out X] = object
|
||||
x: int
|
||||
|
||||
proc f1[in T](x: T) = discard
|
||||
proc f2[in T](x: T) {.importc: "f", header: "foo.h"}
|
||||
|
||||
var
|
||||
f: Foo[int]
|
||||
b: Bar[string]
|
||||
|
||||
f1 f
|
||||
f2 b
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue