remove a special case in sigmatch; distinct pointer types no longer match nil type (#20251)
* remove a special case in sigmatch; distinct pointer types no longer match `nil` type * add tests * fixes tests * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
parent
7d7886b729
commit
1182216381
4 changed files with 30 additions and 15 deletions
23
tests/errmsgs/tdistinct_nil.nim
Normal file
23
tests/errmsgs/tdistinct_nil.nim
Normal file
|
|
@ -0,0 +1,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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue