Skip to content

Wrong constructor type for trait constructor with implicits #2794

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

Closed
nicolasstucki opened this issue Jun 23, 2017 · 3 comments
Closed

Wrong constructor type for trait constructor with implicits #2794

nicolasstucki opened this issue Jun 23, 2017 · 3 comments

Comments

@nicolasstucki
Copy link
Contributor

trait Foo(implicit n: Int)
class Bar extends Foo(1)

fails with

2 |class Bar extends Foo(1)
  |                      ^
  |                      too many arguments for constructor Foo: ()(implicit n: Int)Foo
@nicolasstucki
Copy link
Contributor Author

The original code that I was trying to compile was something like this

trait Foo[T: ClassTag]
class Bar extends Foo[Int]

@nicolasstucki
Copy link
Contributor Author

Currently a workaround is to put the non implicit parameters of the constructor explicitly

trait Foo()(implicit n: Int)
class Bar extends Foo()(1)

@odersky
Copy link
Contributor

odersky commented Jul 16, 2017

This is actually a duplicate of #2576.

@odersky odersky marked this as a duplicate of #2576 Jul 16, 2017
@odersky odersky closed this as completed Jul 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants