New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Quill compatible with Scala 2.12.2 #770
Conversation
ea0ec36
to
3be6274
Compare
I've been trying to add some dummy abstract methods to Quoted / make it abstract class and compile it without |
07433dc
to
2c1c33c
Compare
@mentegy what's the error message? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@getquill/maintainers
After doing some research on this it seems like current workaround with "-Xsource:2.11"
does not work for us. We need to figure out how to fix such errors introduced with 2.12
@@ -842,7 +844,7 @@ class QuotationSpec extends Spec { | |||
} | |||
"abritrary" in { | |||
val q = quote(lift(String.valueOf(1))) | |||
q.liftings.`java.this.lang.String.valueOf(1)`.value mustEqual String.valueOf(1) | |||
//q.liftings.`java.lang.String.valueOf(1)`.value mustEqual String.valueOf(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
is required by 2.11 and fail without, opposite to 2.12 which fails with.
How should we handle that? Keep scala-2.1* different test directories or something like that. Any ideas?
build.sbt
Outdated
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, 12)) => Seq("-Xsource:2.11") ++ orig.map { | ||
case "-Xlint" => "-Xlint:-unused,_" | ||
case "-Ywarn-unused-import" => "-Ywarn-unused:imports,-patvars" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to keep only unused import flags as in 2.11
build.sbt
Outdated
scalacOptions := { | ||
val orig = scalacOptions.value | ||
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, 12)) => Seq("-Xsource:2.11") ++ orig.map { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a problem with that. I have put this flag only to core module and it didn't work. Imho, forcing users to add this flag into their builds doesn't make sense.
build/build.sh
Outdated
sbt coverageOff publish | ||
else | ||
sbt clean coverage test tut coverageReport coverageAggregate checkUnformattedFiles | ||
sbt clean coverage +test tut coverageReport coverageAggregate checkUnformattedFiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this didn't work also, I don't see any 2.12
appearances in travis logs
@@ -724,6 +725,7 @@ class QuotationSpec extends Spec { | |||
quote(unquote(q)).ast match { | |||
case Function(params, Tuple(values)) => | |||
values mustEqual params | |||
case _ => require(false, "Should not happen") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match is not exhaustive
case class Test(a: String) | ||
val t = Test("a") | ||
case class TestEntity(a: String) | ||
val t = TestEntity("a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot detailed error however it is connected with suspicious shadowing of generated class name or something like that
@fwbrasil type mismatch, 2 types - with and without stacktrace:
UPD. seems like stack trace is thrown only for dynamic queries |
1c4212d
to
2405f81
Compare
@getquill/maintainers Build successfully passes against 2.11/2.12 scala version. Please review. |
bfc27c8
to
4452951
Compare
build.sbt
Outdated
if (scalaVersion.value.startsWith("2.12.")) "-Xfatal-warnings" else "" | ||
) | ||
) | ||
lazy val `scala 2.12 hacks` = Seq( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the plan for removing these hacks? Are they due to scala bugs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one brings back -Xfatal-warnings
for 2.12, but fails only for unused imports rather than all others (params, patvars and so on). So with this new hack we bring the behavior as with 2.11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, it's more granular! I'm still curious how we're going to get rid of the hacks, though. Is it something we can fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will just rename it seems like it'll be persistent since scala/scala#5402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fwbrasil Also look here https://github.com/som-snytt/scala/blob/bad61ce0ff9f460c2f8873c134a7f6bee0a53824/src/compiler/scala/tools/nsc/settings/Warnings.scala#L25-L30
For now we use only imports
@@ -857,7 +859,7 @@ class QuotationSpec extends Spec { | |||
} | |||
"abritrary" in { | |||
val q = quote(lift(String.valueOf(1))) | |||
q.liftings.`java.this.lang.String.valueOf(1)`.value mustEqual String.valueOf(1) | |||
//q.liftings.`java.this.lang.String.valueOf(1)`.value mustEqual String.valueOf(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like my previous message has been lost with rebase. I'm not sure what should I do here. this
must be present in 2.11, but in 2.12 should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can try to replace String.valueOf(1)
with a tree that doesn't have this package naming issue. Maybe a scala object in the stdlib?
@@ -726,6 +726,7 @@ class QuotationSpec extends Spec { | |||
quote(unquote(q)).ast match { | |||
case Function(params, Tuple(values)) => | |||
values mustEqual params | |||
case _ => require(false, "Should not happen") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use io.getquill.util.Messages.fail
f1c56ab
to
2361b5f
Compare
q.liftings.`java.this.lang.String.valueOf(1)`.value mustEqual String.valueOf(1) | ||
class A { def x = 1 } | ||
val q = quote(lift(new A().x)) | ||
q.liftings.`new A().x`.value mustEqual new A().x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fwbrasil I hope this works for such test case, since using static calls as before is prohibit fr cross compilation
scalacOptions ++= { | ||
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, 11)) => Seq("-Xlint", "-Ywarn-unused-import") | ||
case Some((2, 12)) => Seq("-Xlint:-unused,_", "-Ywarn-unused:imports") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it should be more convenient
This is awesome, thanks! :) |
Fixes #231
Problem
Build fails against 2.12
Solution
Make Quill compatible with 2.12.2, more in todo list
README.md
if applicable[WIP]
to the pull request title if it's work in progresssbt scalariformFormat test:scalariformFormat
to make sure that the source files are formatted@getquill/maintainers