summary refs log blame commit diff stats
path: root/tests/errmsgs/tinvalidinout.nim
blob: ce7eb6022c1070cec7340fa5d4f7f38fdeb0f21d (plain) (tree)
1
2
3
4
5
6
7

                      
                                                                  
           


                                                                                       


















                                                    
discard """
cmd: "nim check $file"
errormsg: "The `in` modifier can be used only with imported types"
nimout: '''
tinvalidinout.nim(14, 7) Error: The `out` modifier can be used only with imported types
tinvalidinout.nim(17, 9) Error: The `in` modifier can be used only with imported types
tinvalidinout.nim(18, 9) Error: The `in` modifier 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