Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make var/pointer types not match if base type has to be converted #24130

Merged
merged 8 commits into from
Sep 18, 2024

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Sep 17, 2024

split again from #24038, fixes status-im/nimbus-eth2#6554 (comment)

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.

@@ -164,8 +162,7 @@ pkg "ssostrings"
pkg "stew"
pkg "stint", "nim c stint.nim"
pkg "strslice"
pkg "strunicode", "nim c -r --mm:refc src/strunicode.nim",
preCmd = "nimble install -y normalize@#HEAD; nimble uninstall -y normalize; nimble install -y normalize@#HEAD"
pkg "strunicode", "nimble uninstall -i -y normalize; nimble install -y normalize@#HEAD; nimble install --depsOnly -y; nim c -r --mm:refc src/strunicode.nim"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked @nitely to bump normalize's version, in hopes this hack won't be needed anymore.

@Araq Araq merged commit 1660ddf into nim-lang:devel Sep 18, 2024
19 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 1660ddf

Hint: mm: orc; opt: speed; options: -d:release
174440 lines; 8.089s; 654.004MiB peakmem

narimiran pushed a commit that referenced this pull request Sep 18, 2024
…24130)

split again from #24038, fixes
status-im/nimbus-eth2#6554 (comment)

`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.

(cherry picked from commit 1660ddf)
metagn added a commit to metagn/Nim that referenced this pull request Sep 21, 2024
…im-lang#24130)

split again from nim-lang#24038, fixes
status-im/nimbus-eth2#6554 (comment)

`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 nim-lang#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants