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

type argument's default value can't depend on a generic (+ weird error messages) #9355

Open
dawkot opened this issue Oct 13, 2018 · 1 comment

Comments

@dawkot
Copy link

dawkot commented Oct 13, 2018

func foo[T](U = T): U = discard

Error: type expected

func foo[T](U: type = T): U = discard

assert foo[int]() is int

Error: cannot instantiate: 'foo[int]'; got 1 type(s) but expected 2

@narimiran
Copy link
Member

The same error is in #4164 and #4688.

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