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

Intellij syntax error: "Application does not take parameters" #631

Closed
chrisbenincasa opened this issue Aug 25, 2016 · 19 comments
Closed

Intellij syntax error: "Application does not take parameters" #631

chrisbenincasa opened this issue Aug 25, 2016 · 19 comments
Labels
Milestone

Comments

@chrisbenincasa
Copy link

chrisbenincasa commented Aug 25, 2016

Hello, I'm wondering if there's a way to get IntelliJ (I'm using v15.0.6 with Scala plugin 2.2.0) to be able to recognize the implicit conversion to a Mapper when applying an Endpoint.

Screenshot:
screen shot 2016-08-25 at 11 43 32 am

The reported error is "Application does not take parameters". Of course, this error is spurious (the code compiles). IntelliJ just seems to have some trouble with the conversion of my functions to Mappers (and probably also to FnToProduct). Not sure if this is a common issue for people using Finch in IntelliJ. Any help would be greatly appreciated!

@vkostyukov
Copy link
Collaborator

Thanks @chrisbenincasa!

I'm (and I think everyone else is) aware of this problem. One workaround I use is to disable type-checker in IntelliJ (hit that green [T] in the right bottom corner). Although, this basically disables the everything in the IDE besides autocompletion. I think the best we can do here is to file a ticket against the Scala plugin (and vote it!) and mention this problem as false-alarm. They usually respond quite promptly.

I personally nearly hate this "magnet pattern" thing we use as Mapper to allow this DSL-like syntax. I have some ideas how to make it more explicit (extract the syntax layer into its own namespace) and perhaps simplify. Although, this doesn't mean IntelliJ shouldn't support this pattern. Lots of Scala libraries use it and I think, the Scala plugin is making a quite a decent progress in better supporting it.

@od0
Copy link

od0 commented Nov 29, 2016

Just a note - this appears to not be an issue in 2016.2, but resurfaces in 2016.3 (along with other unrelated Scala bugs)

Here is a link to download the latest good release, 2016.2.5: https://confluence.jetbrains.com/display/IntelliJIDEA/Previous+IntelliJ+IDEA+Releases

@chrisbenincasa
Copy link
Author

@od0 interesting. I'm on 2016.3.1 (Scala plugin 2016.3.5) and the error has changed slightly:

screen shot 2016-12-16 at 2 09 55 pm

Basically that, but for every endpoint.

Sorry for the delay, but thank you for the reply, @vkostyukov. I'll look into opening up an issue on the Scala plugin.

@bergmark
Copy link

Has anyone reported this bug on the scala plugin issue tracker?

@chrisbenincasa
Copy link
Author

@bergmark This totally slipped my mind; I never opened up an issue.

@rpless
Copy link
Collaborator

rpless commented Feb 19, 2017

I've seen noticeably fewer of these errors after switching to the 2017 EAP release. And the errors are usually fixed by invalidating caches. Has anyone else tried the EAP?

@od0
Copy link

od0 commented Feb 20, 2017

@rpless I'm on the latest EAP now and it's as bad as ever :/

@manub
Copy link

manub commented Feb 20, 2017

Having a problem which may be related to this with the Hello World example. Both on IntelliJ 2016.3 and 2017 EAP. sbt compile works. Invalidating caches didn't help. Using Scala 2.12.

screenshot 2017-02-20 22 56 16

@vkostyukov
Copy link
Collaborator

vkostyukov commented Feb 20, 2017

I went ahead and filed an Intellij ticket (against Scala plugin): SCL-11386.

@marceloboeira
Copy link

My 2 cents:

That does not raise the warning:

  val api: Endpoint[String] = get("hello") { Ok("Foo") }

However, this raises it:

screen shot 2017-07-23 at 11 47 38

And if I declare the params, it does not compile at all:

screen shot 2017-07-23 at 11 49 07

@marceloboeira
Copy link

marceloboeira commented Jul 23, 2017

It seems that everything works if updated to:

IntelliJ IDEA 2017.2
Build #IC-172.3317.76, built on July 15, 2017
JRE: 1.8.0_152-release-915-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
Scala Plugin: 2017.2.5

@ssenge
Copy link

ssenge commented Jul 28, 2017

@marceloboeira: I have the same setup but run into these issues, it is compilable though:

screen shot 2017-07-28 at 16 42 10

screen shot 2017-07-28 at 16 42 35

@marceloboeira
Copy link

@ssenge they've disappeared after I updated the IDE/plugin. For me, it was compiling only over the terminal, but not from the IDE.

@ssenge
Copy link

ssenge commented Jul 28, 2017

@marceloboeira: Compilable from IDE but wrong error highlighting :( Everything updated and rebuild.

@sergeykolbasov
Copy link
Collaborator

This one should be solved now with #858

@vkostyukov
Copy link
Collaborator

I think we're in a good place to close this. We can always re-open if things get broken again. Huge thanks to @sergeykolbasov for taking a stub on fixing this!

@vkostyukov vkostyukov added this to the Finch 1.0 milestone Mar 19, 2018
@acidghost
Copy link

I'm having issues with IntelliJ 2018.3.4 and finch 0.27.0. In the following snippet

val forSale: Endpoint[F, Seq[Product]] =
  get("products" :: "for-sale" :: param[DeliveriesDayOfWeek]("dow")).mapAsync {
    dow => productService.forSale(dow)
  }

the IDE wrongfully thinks that dow is of type DeliveriesDayOfWeek :: HNil, while is instead a DeliveriesDayOfWeek. The code compiles just fine.

@vkostyukov
Copy link
Collaborator

@acidghost Thus is surprising to me. I was under the impression it was fixed quite some time ago. I'd recommend leaving a comment on a linked IJ ticket with your reproducer.

@sergeykolbasov
Copy link
Collaborator

sergeykolbasov commented Feb 24, 2019

Yep, I can reproduce it, though it's a different problem not related to Mapper anyhow.
We have a custom PairAdjoin that for a composition with single element returns A instead of A :: HNil. I think IDEA fails to understand it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants