简体   繁体   中英

Scala syntax error at IntelliJ IDEA, but compile successfully via sbt

I defined a variable at my program

import cats.data.{Kleisli, Xor, XorT}
val a = Kleisli[XorT[TwitterFuture, Exception, ?], String, Int] = Kleisli { (s: String) =>
XorT[TwitterFuture, Exception, Int](TwitterFuture(Xor.Right(123)))
}

my build.sbt:

addCompilerPlugin("org.scalamacros" % "paradise"         % "2.1.0" cross CrossVersion.full)
addCompilerPlugin("org.spire-math"  % "kind-projector"   % "0.8.0" cross CrossVersion.binary)
addCompilerPlugin("com.milessabin"  % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full)

It's very weird that there was a "type mismatch" error on IntelliJ IDEA. Type mismatch, expected: (NotInferedA) => NotInferedF[NotInferedB], actual: (String) => XorT[TwitterFuture, Exception, Int]

But I executed sbt compile successfully, no any errors.

My IntelliJ IDEA version: 2016.2.2

Does someone know what's going on with this situation? How do I fix the problem?

Intellij scala plugin is great, but heavy scala code (types/implicits/macros magic) still is not processed correctly. You can create a ticket in https://youtrack.jetbrains.com/oauth?state=%2Fissues%2FIDEA or vote for existing, and wait for plugin patches.

Also you can patch it yourself: https://github.com/JetBrains/intellij-scala .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM