diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-08-24 01:27:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 19:27:20 +0200 |
commit | 1182216381cdd17b75e16133ce2c79084dd3d3f9 (patch) | |
tree | 85e3c4edea3889dee2125188acc7703dc4072947 /tests/errmsgs/tdistinct_nil.nim | |
parent | 7d7886b729b40872cc2ad7c0c370179b6b39df0c (diff) | |
download | Nim-1182216381cdd17b75e16133ce2c79084dd3d3f9.tar.gz |
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>
Diffstat (limited to 'tests/errmsgs/tdistinct_nil.nim')
-rw-r--r-- | tests/errmsgs/tdistinct_nil.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/errmsgs/tdistinct_nil.nim b/tests/errmsgs/tdistinct_nil.nim new file mode 100644 index 000000000..a2b403293 --- /dev/null +++ b/tests/errmsgs/tdistinct_nil.nim @@ -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) |