summary refs log tree commit diff stats
path: root/tests/converter/tconverter_with_constraint.nim
blob: 7932644340063790893daf49521d0a53ee2dd6b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  file: "tconverter_with_constraint.nim"
  line: 20
  errormsg: "type mismatch: got <int>"
"""

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