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

distinct generic typeclass not treated as distinct #4435

Closed
jcosborn opened this issue Jul 1, 2016 · 0 comments
Closed

distinct generic typeclass not treated as distinct #4435

jcosborn opened this issue Jul 1, 2016 · 0 comments
Assignees
Labels

Comments

@jcosborn
Copy link
Contributor

@jcosborn jcosborn commented Jul 1, 2016

The distinct generic types A[T] and B[T] are not treated as distinct when used as typeclasses. Using them with the generic parameter still works though. This code works in 0.13.

type
  A[T] = distinct T
  B[T] = distinct T

proc foo[T](x:A[T]) = echo "A"
proc foo[T](x:B[T]) = echo "B"
proc bar(x:A) = echo "A"
proc bar(x:B) = echo "B"

var
  a:A[int]

foo(a) # fine
bar(a) # testdistinct.nim(14, 4) Error: ambiguous call; both testdistinct.bar(x: A) and testdistinct.bar(x: B) match for: (A[system.int])
@zah zah self-assigned this May 13, 2017
@zah zah added the Generics label May 13, 2017
jcosborn added a commit to jcosborn/Nim that referenced this issue Oct 4, 2018
@Araq Araq closed this in dd65986 Oct 9, 2018
krux02 added a commit to krux02/Nim that referenced this issue Oct 15, 2018
narimiran added a commit to narimiran/Nim that referenced this issue Oct 31, 2018
narimiran added a commit to narimiran/Nim that referenced this issue Nov 1, 2018
narimiran added a commit that referenced this issue Nov 1, 2018
(cherry picked from commit dd65986)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants