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

Router generation fails if API has a function with no parentheses #48

Open
ochrons opened this issue Apr 19, 2016 · 2 comments
Open

Router generation fails if API has a function with no parentheses #48

ochrons opened this issue Apr 19, 2016 · 2 comments

Comments

@ochrons
Copy link

ochrons commented Apr 19, 2016

Minified example:

trait CustomerAPI {
  def load: Seq[Customer]
}

val customerAPI = new CustomerAPIService
val router = Router.route[CustomerAPI](customerAPI)

This does't compile and gives a "weird" error:

not enough arguments for method apply: (idx: Int)admin.shared.Customer in trait SeqLike.
[error] Unspecified value parameter idx.
[error]   val router = Router.route[CustomerAPI](customerAPI)
[error]                                         ^

It seems to somehow go into the trait and get the load function, for which you would have to call apply with an index.

Adding parentheses to the load function fixes the problem.

trait CustomerAPI {
  def load(): Seq[Customer]
}
@dsabanin
Copy link

dsabanin commented Jun 9, 2016

Also see the same issue, it was very frustrating.

@yarulan
Copy link

yarulan commented Jun 25, 2016

Thanks guys, you saved by day. I had different error message, but not less frustrating.

trait Api {
  def getMessage: String
}

AutowireServer.route[Api](ApiImpl)

Error:(39, 38) type mismatch;
 found   : String
 required: ?{def apply: ?}
            AutowireServer.route[Api](ApiImpl)
                                     ^

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

3 participants