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 #22826: Don't skip generic instances in type comparison #22828

Merged
merged 2 commits into from
Oct 21, 2023

Conversation

SirOlaf
Copy link
Contributor

@SirOlaf SirOlaf commented Oct 15, 2023

Close #22826

I am not sure why this code skips generic insts, so letting CI tell me.
Update: It has told me nothing. Maybe someone knows during review.

Issue itself seems to be that the generic instance is skipped thus it ends up being just float which makes it use the wrong generic instance of the proc because it matches the one in cache

@SirOlaf SirOlaf changed the title Debug #22826 Fix #22826: Don't skip generic instances in type comparison Oct 16, 2023
@SirOlaf SirOlaf marked this pull request as ready for review October 16, 2023 01:28
@SirOlaf SirOlaf closed this Oct 20, 2023
@SirOlaf SirOlaf reopened this Oct 20, 2023
@Araq Araq merged commit c13c485 into nim-lang:devel Oct 21, 2023
31 of 32 checks passed
@github-actions
Copy link
Contributor

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

Hint: mm: orc; opt: speed; options: -d:release
174728 lines; 12.189s; 769.898MiB peakmem

@alaviss
Copy link
Collaborator

alaviss commented Jan 12, 2024

This PR broke sameType between generic alias and concrete type:

import macros

type
  A[T] = T

macro eqTyp(x, y: typed) =
  # NOTE: the `or` is due to sameType not being commutative: https://github.com/nim-lang/Nim/issues/18867
  doAssert sameType(x, y) or sameType(y, x), "nim does not consider these to be the same!"

eqTyp(A[float], float)

narimiran pushed a commit that referenced this pull request Apr 18, 2024
Close #22826

I am not sure why this code skips generic insts, so letting CI tell me.
Update: It has told me nothing. Maybe someone knows during review.

Issue itself seems to be that the generic instance is skipped thus it
ends up being just `float` which makes it use the wrong generic instance
of the proc because it matches the one in cache

---------

Co-authored-by: SirOlaf <>
(cherry picked from commit c13c485)
narimiran added a commit that referenced this pull request Jun 7, 2024
narimiran pushed a commit that referenced this pull request Sep 16, 2024
Close #22826

I am not sure why this code skips generic insts, so letting CI tell me.
Update: It has told me nothing. Maybe someone knows during review.

Issue itself seems to be that the generic instance is skipped thus it
ends up being just `float` which makes it use the wrong generic instance
of the proc because it matches the one in cache

---------

Co-authored-by: SirOlaf <>
(cherry picked from commit c13c485)
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.

Invalid type checking for two instances of the same Generic type
3 participants