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

varags broken with polymorphic types #4799

Closed
johnnovak opened this issue Sep 19, 2016 · 0 comments
Closed

varags broken with polymorphic types #4799

johnnovak opened this issue Sep 19, 2016 · 0 comments
Assignees

Comments

@johnnovak
Copy link
Contributor

Currently, it is not possible to pass in subtyped objects in varags arguments.

type
  Base = ref object of RootObj
  A = ref object of Base
  B = ref object of Base

proc test(oa: varargs[Base]) = discard

#test(A()))          # FAILS TO COMPILE:
                     # Error: type mismatch: got (A)
                     # but expected one of:
                     # proc test(oa: varargs[Base])

#test(A(), B())      # FAILS TO COMPILE:
                     # Error: type mismatch: got (A, B)
                     # but expected one of:
                     # proc test(oa: varargs[Base])
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

No branches or pull requests

2 participants