Skip to content
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

More Scalafix #2888

Closed
wants to merge 2 commits into from
Closed

More Scalafix #2888

wants to merge 2 commits into from

Conversation

guizmaii
Copy link
Member

No description provided.

@@ -36,7 +37,7 @@ class SetsEncodingSpec extends CollectionsSpec with CassandraAlpakkaSpec {
Set(Instant.now()),
Set(UUID.randomUUID())
)
val q = quote(query[SetsEntity])
val q: Quoted[EntityQuery[SetsEntity]] = quote(query[SetsEntity])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -18,7 +18,7 @@ object Quill {
ZLayer.fromFunction((session: CassandraZioSession) => new Cassandra[N](naming, session))
}

final case class Cassandra[+N <: NamingStrategy](val naming: N, session: CassandraZioSession)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO BACKPORT TO PREVIOUS PR


trait CassandraTestEntities extends TestEntities {
this: CassandraContext[_] =>

case class MapFrozen(id: Map[Int, Boolean])
val mapFroz = quote(query[MapFrozen])
val mapFroz: Quoted[EntityQuery[MapFrozen]] = quote(query[MapFrozen])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE


case class SetFrozen(id: Set[Int])
val setFroz = quote(query[SetFrozen])
val setFroz: Quoted[EntityQuery[SetFrozen]] = quote(query[SetFrozen])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE


case class ListFrozen(id: List[Int])
val listFroz = quote(query[ListFrozen])
val listFroz: Quoted[EntityQuery[ListFrozen]] = quote(query[ListFrozen])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -49,7 +49,7 @@ class CqlIdiomSpec extends Spec {

"distinct" - {
"simple" in {
val q = quote {
quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO PUT BACK

@@ -126,13 +126,13 @@ class CqlIdiomSpec extends Spec {
"SELECT s, i, l, o, b FROM TestEntity WHERE i = 1"
}
"unary (not supported)" in {
val q = quote {
quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO PUT BACK

qr1.filter(t => !(t.i == 1))
}
"mirrorContext.run(q)" mustNot compile
}
"function apply (not supported)" in {
val q = quote {
quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO PUT BACK

Comment on lines +23 to +34
val deleteAll: Quoted[Delete[OrderTestEntity]] = quote(query[OrderTestEntity].delete)
val selectAll: Quoted[EntityQuery[OrderTestEntity]] = quote(query[OrderTestEntity])
val map: Quoted[EntityQuery[Int]] = quote(query[OrderTestEntity].map(_.id))
val filter: Quoted[EntityQuery[OrderTestEntity]] = quote(query[OrderTestEntity].filter(_.id == 1))
val withFilter: Quoted[EntityQuery[OrderTestEntity]] = quote(query[OrderTestEntity].withFilter(_.id == 1))
val sortBy: Quoted[Query[OrderTestEntity]] = quote(query[OrderTestEntity].filter(_.id == 1).sortBy(_.i)(Ord.asc))
val take: Quoted[Query[OrderTestEntity]] = quote(query[OrderTestEntity].take(10))
val entitySize: Quoted[Long] = quote(query[OrderTestEntity].size)
val parametrizedSize: Quoted[Int => Long] = quote { (id: Int) =>
query[OrderTestEntity].filter(_.id == id).size
}
val distinct = quote(query[OrderTestEntity].map(_.id).distinct)
val distinct: Quoted[Query[Int]] = quote(query[OrderTestEntity].map(_.id).distinct)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

Comment on lines +11 to +15
val e: Quoted[EntityQuery[TestEntity]] = quote {
querySchema[TestEntity]("test_entity", _.s -> "field_s", _.i -> "field_i")
}

val f = quote {
val f: Quoted[EntityQuery[TestEntity]] = quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -74,24 +74,24 @@ class OpsSpec extends Spec {
}

implicit class QueryOps[Q <: Query[_]](q: Q) {
def allowFiltering = quote(sql"$q ALLOW FILTERING".as[Q])
def allowFiltering: Quoted[Q] = quote(sql"$q ALLOW FILTERING".as[Q])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

Comment on lines +48 to +69
val qr1: Quoted[EntityQuery[TestEntity]] = quote {
query[TestEntity]
}
val qr1Emb = quote {
val qr1Emb: Quoted[EntityQuery[TestEntityEmb]] = quote {
querySchema[TestEntityEmb]("TestEntity")
}
val qr2 = quote {
val qr2: Quoted[EntityQuery[TestEntity2]] = quote {
query[TestEntity2]
}
val qr3 = quote {
val qr3: Quoted[EntityQuery[TestEntity3]] = quote {
query[TestEntity3]
}
val qr4 = quote {
val qr4: Quoted[EntityQuery[TestEntity4]] = quote {
query[TestEntity4]
}
val qr5 = quote {
val qr5: Quoted[EntityQuery[TestEntity5]] = quote {
query[TestEntity5]
}
val qr4Emb = quote {
val qr4Emb: Quoted[EntityQuery[TestEntity4Emb]] = quote {
querySchema[TestEntity4Emb]("TestEntity4")
}
val qrRegular = quote {
val qrRegular: Quoted[EntityQuery[TestEntityRegular]] = quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -30,7 +30,7 @@ class UnlimitedOptionalEmbeddedSpec extends Spec {
)
)

val qrOptEmd = quote {
val qrOptEmd: Quoted[EntityQuery[OptEmd]] = quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -3,6 +3,8 @@ package io.getquill.base
import io.getquill.context.Context

import java.util.Date
import io.getquill.{Delete, Insert, Quoted}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TO REMOVE

@@ -320,7 +320,7 @@ class ContextMacroSpec extends Spec {
}

"fails if there's a free variable" in {
val q = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK

}
testContext.run(q).prepareRow mustEqual Row(1d)
}

"fails for not value class without encoder" in {
case class NotValueClass(value: Int)
case class Entity(x: NotValueClass)
val q = quote { (x: NotValueClass) =>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK

}
attachToEntity(q.ast) mustEqual n.ast
}
}
}

val iqr1 = quote {
val iqr1: Quoted[Query[TestEntity]] = quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOVE

@@ -6,14 +6,15 @@ import io.getquill.MirrorContexts.testContext.qr1
import io.getquill.MirrorContexts.testContext.qr2
import io.getquill.MirrorContexts.testContext.quote
import io.getquill.MirrorContexts.testContext.unquote
import io.getquill.Quoted
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOVE

val quat = Quat.Product("Test")
val s = string(3)
Entity(s, Nil, Quat.Product("Test", (1 to 20).map(i => (string(3), Quat.Value)).toList.distinct: _*))
Quat.Product("Test")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOVE?

@@ -136,7 +135,7 @@ class QuatSpec extends Spec {
val p: Quat = Quat.Product("p", "foo" -> Quat.Value)
val v: Quat = Quat.Value
p.probit mustEqual p
val e = intercept[QuatException] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK?

@@ -160,7 +159,7 @@ class QuatSpec extends Spec {
"rename field" in {
prod.withRenames(List("bv" -> "bva", "p" -> "pa")).applyRenames mustEqual expect
}
val e = intercept[QuatException] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK?

}
}
"forced" in {
val q = qr1.dynamic
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK

@@ -2059,7 +2066,7 @@ class QuotationSpec extends Spec {
}

"ignores the ifrefutable call" in {
val q = quote {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?PUT BACK

@@ -2107,8 +2114,8 @@ class QuotationSpec extends Spec {
}

"doesn't double quote" in {
val q = quote(1)
val dq: Quoted[Int] = quote(q)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?PUT BACK

Await.result(testContext.run(query[EncodingTestEntity]), Duration.Inf)
}
}
"non-numeric" in {
Await.result(testContext.run(liftQuery(insertValues).foreach(e => insert(e))), Duration.Inf)
case class EncodingTestEntity(v1: Date)
val e = intercept[IllegalStateException] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK?

@@ -100,15 +100,15 @@ class MysqlJAsyncEncodingSpec extends EncodingSpec {
"fails if the column has the wrong type" - {
"numeric" in {
Await.result(testContext.run(liftQuery(insertValues).foreach(e => insert(e))), Duration.Inf)
case class EncodingTestEntity(v1: Int)
val e = intercept[IllegalStateException] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT BACK?

@@ -3,6 +3,6 @@ package io.getquill
import monix.execution.Scheduler

package object h2 {
private implicit val scheduler = Scheduler.global
Scheduler.global
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOVE?

@guizmaii guizmaii closed this Oct 2, 2023
@guizmaii guizmaii deleted the scalafix_2 branch October 2, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant