Skip to content

Conversation

@metagn
Copy link
Collaborator

@metagn metagn commented Sep 6, 2023

fixes #22639 for the third time

Nodes generated by getType for tyGenericInst types, instead of having the original tyGenericInst type, will have the type of the last child (due to the mapTypeToAst calls which set the type to the given argument). This will cause subsequent getType calls to lose information and think it's OK to use the sym of the instantiated type rather than fully expand the generic instantiation.

To prevent this, update the type of the node from the mapTypeToAst calls to the full generic instantiation type.

@Araq Araq merged commit ed9e3cb into nim-lang:devel Sep 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

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

Hint: mm: orc; opt: speed; options: -d:release
169666 lines; 12.011s; 611.172MiB peakmem

narimiran pushed a commit that referenced this pull request Apr 17, 2024
fixes #22639 for the third time

Nodes generated by `getType` for `tyGenericInst` types, instead of
having the original `tyGenericInst` type, will have the type of the last
child (due to the `mapTypeToAst` calls which set the type to the given
argument). This will cause subsequent `getType` calls to lose
information and think it's OK to use the sym of the instantiated type
rather than fully expand the generic instantiation.

To prevent this, update the type of the node from the `mapTypeToAst`
calls to the full generic instantiation type.

(cherry picked from commit ed9e3cb)
metagn added a commit to metagn/Nim that referenced this pull request Dec 5, 2024
metagn added a commit to metagn/Nim that referenced this pull request Dec 5, 2024
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.

sizeof for static arrays can yield wrong results

2 participants