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

                      
                                                                  
           


                                                                                       



    
                                                   













                                                    
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[in T] {.header: "foo.h", importcpp.} = 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