summary refs log tree commit diff stats
path: root/tests/errmsgs/tdistinct_nil.nim
blob: a2b403293bf06c3406b216c1a3419c6aa7a78eab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
discard """
  cmd: "nim check $file"
  action: reject
  nimout: '''
tdistinct_nil.nim(23, 4) Error: type mismatch: got <typeof(nil)>
but expected one of:
proc foo(x: DistinctPointer)
  first type mismatch at position: 1
  required type for x: DistinctPointer
  but expression 'nil' is of type: typeof(nil)

expression: foo(nil)
'''
"""

type
  DistinctPointer = distinct pointer

proc foo(x: DistinctPointer) =
  discard

foo(DistinctPointer(nil))
foo(nil)