Search code examples
scalaintellij-idea

Scala Presentation Compiler and IntelliJ


The following definition...

object Category {
  def fCat = new Category[Function1] {
    def compose[A, B, C](f: (B) => C)(g: (A) => B) = { a: A => f(g(a)) }
  }
}

... is valid if Category is defined as:

trait Category[~>[_, _]] {
  def compose[A, B, C](f: ~>[B, C])(g: ~>[A, B]): ~>[A, C]
}

... but not when infixing the type constructor:

  def compose[A, B, C](f: B ~> C)(g: A ~> B): A ~> C

Here IntelliJ complains that member compose is not defined in fCat.

Is this a limitation of the Presentation Compiler? IntelliJ's Scala plugin? Or am I overlooking something?


Solution

  • This is an IntelliJ bug; it has its own presentation compiler.

    I've reported it here: http://youtrack.jetbrains.com/issue/SCL-4179