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

Overload precedence for non-builtin types #11239

mratsim opened this issue May 13, 2019 · 0 comments


None yet
2 participants
Copy link

commented May 13, 2019


type MySeq*[T] = object

proc foo(a: seq[int]) = echo "foo: seq[int]"
proc foo[T](a: seq[T]) = echo "foo: seq[T]"
proc foo(a: MySeq[int]) = echo "foo: MySeq[int]"
proc foo[T](a: MySeq[T]) = echo "foo: MySeq[T]"

foo(@[1,2,3]) # foo: seq[int]
foo(@["WER"]) # foo: seq[T]
foo(MySeq[int]()) # foo: MySeq[T]
foo(MySeq[string]()) # foo: MySeq[T]

For non-builtin objects the overload precedence is wrong.

@mratsim mratsim added the Generics label May 13, 2019

@Araq Araq added the High Priority label May 15, 2019

Araq added a commit that referenced this issue May 20, 2019

@Araq Araq closed this in 90e882d May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.