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

fix logic for dcEqIgnoreDistinct in sameType #24197

Merged
merged 2 commits into from
Sep 29, 2024

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Sep 28, 2024

fixes #22523

There were 2 problems with the code in sameType for dcEqIgnoreDistinct:

  1. The code that skipped {tyDistinct, tyGenericInst} only ran if the given types had different kinds. This is fixed by always performing this skip.
  2. The code block below that checks if tyGenericInsts have different values still ran for dcEqIgnoreDistinct since it checks if the given types are generic insts, not the skipped types (and also only the 1st given type). This is fixed by only invoking this block for dcEq; dcEqOrDistinctOf (which is unused) also skips the first given type. Arguably there is another issue here that skipGenericAlias only ever skips 1 type.

These combined fix the issue (T is GenericInst(V, 1, distinct int) and D[0] is GenericInst(D, 0, distinct int)).

#24037 shouldn't be a dependency but the diff follows it.

@Araq Araq merged commit b0e6d28 into nim-lang:devel Sep 29, 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 b0e6d28

Hint: mm: orc; opt: speed; options: -d:release
174576 lines; 8.079s; 654.496MiB peakmem

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.

T(a) not an L-value when a is an L-value and typeEqualsOrDistinct(T, typeof(a)) holds
2 participants