summary refs log tree commit diff stats
path: root/tests/errmsgs
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-09-18 18:37:18 +0300
committerGitHub <noreply@github.com>2024-09-18 17:37:18 +0200
commit1660ddf98a6b6fbd8f05b58bbc540bc57523b31c (patch)
treedfda6350da1aee487a9d7eba1754b87ebd33edd5 /tests/errmsgs
parentc759d7abd1b4181fb4931bc95148beac3051bf91 (diff)
downloadNim-1660ddf98a6b6fbd8f05b58bbc540bc57523b31c.tar.gz
make `var`/pointer types not match if base type has to be converted (#24130)
split again from #24038, fixes
https://github.com/status-im/nimbus-eth2/pull/6554#issuecomment-2354977102

`var`/pointer types are no longer implicitly convertible to each other
if their element types either:

* require an int conversion or another conversion operation as long as
it's not to `openarray`,
* are subtypes with pointer indirection,

Previously any conversion below a subrange match would match if the
element type wasn't a pointer type, then it would error later in
`analyseIfAddressTaken`.

Different from #24038 in that the preview define that made subrange
matches also fail to match is removed for a simpler diff so that it can
be backported.
Diffstat (limited to 'tests/errmsgs')
-rw-r--r--tests/errmsgs/t22097.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/errmsgs/t22097.nim b/tests/errmsgs/t22097.nim
index b50db08a3..bb24ee8d3 100644
--- a/tests/errmsgs/t22097.nim
+++ b/tests/errmsgs/t22097.nim
@@ -1,9 +1,9 @@
 discard """
-  errormsg: "for a 'var' type a variable needs to be passed; but 'uint16(x)' is immutable"
+  errormsg: "type mismatch: got <uint8>"
 """
 
 proc toUInt16(x: var uint16) =
   discard
 
 var x = uint8(1)
-toUInt16 x
\ No newline at end of file
+toUInt16 x