summary refs log blame commit diff stats
path: root/tests/converter/tconverter_with_constraint.nim
blob: ce51355861807ffe768a0b9606eaef037623ca97 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12

           
                                      

                                        






                                          
 


                        
                                 

               
                       
discard """
  errormsg: "type mismatch: got <int>"
  file: "tconverter_with_constraint.nim"
  line: 20
"""

type
  MyType = distinct int

converter to_mytype(m: int{lit}): MyType =
  m.MyType

proc myproc(m: MyType) =
  echo m.int, ".MyType"

myproc(1) # call by literal is ok

var x: int = 12
myproc(x) # should fail