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 #14254 #21837

Merged
merged 3 commits into from
May 20, 2023
Merged

fix #14254 #21837

merged 3 commits into from
May 20, 2023

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented May 11, 2023

fixes #14254

Not super clean but can't think of a better solution

@metagn
Copy link
Collaborator Author

metagn commented May 11, 2023

Package failure is because

proc T(x: int): float = x.float

proc foo[T](x: int) =
  echo x.T

foo[uint](123) # 123.0

now behaves like

proc T(x: int): float = x.float

block:
  type T = uint
  proc foo(x: int) =
    echo x.T

  foo(123) # 123

which to me seems like the more consistent behavior. We either patch the package (to use a different name for the generic param) or we don't fix this bug I think.

@metagn
Copy link
Collaborator Author

metagn commented May 14, 2023

Ok yep, this is an inconsistency

proc T(x: int): float = x.float

proc foo[T](x: int) =
  echo typeof T(x) # uint
  echo typeof x.T # float

foo[uint](123)

Made a PR to the package: andreaferretti/neo#53

@Araq
Copy link
Member

Araq commented May 19, 2023

Feel free to fork the package and delegate "important_packages" to the fork or to disable the package for testing so that we can move on with this bugfix. It's pretty nice to have for v2.0.

@metagn
Copy link
Collaborator Author

metagn commented May 20, 2023

Done, CI failure unrelated

@Araq Araq merged commit 641e34b into nim-lang:devel May 20, 2023
@github-actions
Copy link
Contributor

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

Hint: mm: orc; opt: speed; options: -d:release
167395 lines; 8.708s; 613.293MiB 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.

Cross-module refusal of method call syntax for type conversion in generic
2 participants