Created
September 10, 2015 00:55
-
-
Save blast-hardcheese/a9ff3be14f2b052756ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Given this definition, | |
def buildWrites[U, T <: DataTyped[U]](baseWrites: Writes[T])(implicit typeToJs: U => Json.JsValueWrapper): Writes[T] | |
// Works! | |
val someWrites: Writes[SomeDataTyped_v1] = DataTyped.buildWrites[FeedEntryTypes.Value, SomeDataTyped_v1](Json.writes[SomeDataTyped_v1]) | |
// Fails. | |
val someWrites: Writes[SomeDataTyped_v1] = DataTyped.buildWrites(Json.writes[SomeDataTyped_v1]) | |
[error] .../DataSpec.scala:65: type mismatch; | |
[error] found : play.api.libs.json.Writes[viewmodels.DataTyped[Nothing] with models.artFeed.SomeDataTyped_v1] | |
[error] required: play.api.libs.json.Writes[models.artFeed.SomeDataTyped_v1] | |
[error] val someWrites: Writes[SomeDataTyped_v1] = DataTyped.buildWrites(Json.writes[SomeDataTyped_v1]) | |
[error] ^ | |
[error] one error found | |
[error] (core/test:compile) Compilation failed | |
[error] Total time: 1 s, completed Sep 9, 2015 5:53:03 PM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment