0

I came across a weird issue with Intellij-scala-plugin 2017.3.11.1 for IntelliJ CE 2017.3

The following code compiles in sbt, but inside Intellij Scala Editor, there is an error highlighted as the attached picture.

trait Schema[+T, K, G] {
  def group: G
  def toList: List[T]
  def export: List[T]
}

trait Visitor[S[+T], +T, K, G] {
  def export[B >: T](physicalStore: S[B]): List[B]
  def toList[B >: T](physicalStore: S[B]): List[B]
}

case class FlatSchema[S[+T], +T, K, G](group: G, physicalStore: S[T], visitor: Visitor[S, T, K, G]) extends Schema[T, K, G] {
  override def toList: List[T] = visitor.toList[T](physicalStore)
  override def export: List[T] = visitor.export[T](physicalStore)
}

class ContainerVisitor[S[+T] <: List[Schema[T, K, G]], +T, K, G] extends Visitor[S, T, K, G] {
  override def export[B >: T](physicalStore: S[B]): List[B] = physicalStore.flatMap(_.export)
  override def toList[B >: T](physicalStore: S[B]): List[B] = physicalStore.flatMap(_.toList)
}

enter image description here

I configured in IntelliJ with Scalac Options as following:

enter image description here

Inside my build.sbt file, I enabled

scalacOptions ++= Seq("-language:higherKinds")

How can I fix my configuration on IntelliJ or it is a issue for IntelliJ Scala Plugin?

Justin Kaeser
  • 5,868
  • 27
  • 46
Barry Zhong
  • 470
  • 3
  • 17
  • In my case, there are two access patterns against FlatSchema.physicalStore. If physicalStore is simply a List[T], or it is a List[Schema[T, K, G]]. I assume this 'change' can be isolated from the corresponding visitor. for Visitor[S[+T], T, K, G], S is co-variant with T. – Barry Zhong Feb 26 '18 at 05:05
  • This problem seems to be fixed in 2018.1. Can you try upgrading? – Justin Kaeser Mar 26 '18 at 10:45

0 Answers0