Created
March 17, 2016 11:25
-
-
Save lambdista/514397af3a263e82c5ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Operand[A](key: String, value: A) | |
case class Foo(id: Long, bar: String) | |
trait Operation[A] { | |
def operator: String | |
def operand: Option[Operand[A]] | |
} | |
object Operation { | |
case class FooOperation(foo: Foo) extends Operation[Foo] { | |
override def operator: String = "foo" | |
// IntelliJ Community Edition 15.0,4 does not highlight the compilation error for this: | |
override def operand: Option[Foo] = Some(foo) | |
// The compilable version is something like the following: | |
// override def operand: Option[Operand[Foo]] = Some(Operand("someKey", foo)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment