diff --git a/quill-core/src/main/scala/io/getquill/quat/QuatMaking.scala b/quill-core/src/main/scala/io/getquill/quat/QuatMaking.scala index 0036fc8dec..8a39285c6a 100644 --- a/quill-core/src/main/scala/io/getquill/quat/QuatMaking.scala +++ b/quill-core/src/main/scala/io/getquill/quat/QuatMaking.scala @@ -253,14 +253,14 @@ trait QuatMakingBase extends MacroUtilUniverse { } def isPrimitive(tpe: Type): Boolean = - tpe <:< typeOf[String] || - tpe <:< typeOf[Int] || - tpe <:< typeOf[Short] || - tpe <:< typeOf[Long] || - tpe <:< typeOf[Boolean] || - tpe <:< typeOf[Byte] || - tpe <:< typeOf[Float] || - tpe <:< typeOf[Double] + tpe <:< typeOf[String] || + tpe <:< typeOf[Int] || + tpe <:< typeOf[Short] || + tpe <:< typeOf[Long] || + tpe <:< typeOf[Boolean] || + tpe <:< typeOf[Byte] || + tpe <:< typeOf[Float] || + tpe <:< typeOf[Double] object DefiniteValue { def unapply(tpe: Type): Option[Type] = diff --git a/quill-engine/src/main/scala/io/getquill/ast/Ast.scala b/quill-engine/src/main/scala/io/getquill/ast/Ast.scala index 9c31e68cee..f47ec6a82c 100644 --- a/quill-engine/src/main/scala/io/getquill/ast/Ast.scala +++ b/quill-engine/src/main/scala/io/getquill/ast/Ast.scala @@ -34,7 +34,7 @@ sealed trait Ast { object Ast { object LeafQuat { def unapply(ast: Ast): Option[Ast] = - if (!ast.quat.isInstanceOf[Quat.Product] && ast.isInstanceOf[Value]) + if (!ast.quat.isInstanceOf[Quat.Product]) Some(ast) else None diff --git a/quill-engine/src/main/scala/io/getquill/norm/SheathLeafClauses.scala b/quill-engine/src/main/scala/io/getquill/norm/SheathLeafClauses.scala index 89aaff0516..f13484a3ed 100644 --- a/quill-engine/src/main/scala/io/getquill/norm/SheathLeafClauses.scala +++ b/quill-engine/src/main/scala/io/getquill/norm/SheathLeafClauses.scala @@ -317,12 +317,13 @@ case class SheathLeafClauses(state: Option[String], traceConfig: TraceConfig) (Join(t, a1m, b1m, iA, iB, on), SheathLeafClauses(None, traceConfig)) } - case Filter(ent, e, LeafQuat(body)) => + // For filter clauses the body is always a quat:V so we check the ident to see if it's something that needs to be sheathed + case Filter(ent, LeafQuat(e: Ident), body) => val (ent1, s) = apply(ent) val e1 = Ident(e.name, ent1.quat) - // For filter clauses we want to go from: Filter(M(ent,e,e.v),e == 123) to Filter(M(ent,e,CC(v->e.v)),e,e.v == 123) + // For filter clauses we want to go from: Filter(M(ent,e,e.v),x == 123) to Filter(M(ent,e,CC(v->e.v)),x,x.v == 123) // the body should not be re-sheathed since a body of CC(v->e.v == 123) would make no sense since - // that's not even a boolean. Instead we just need to do e.v == 123. + // that's not even a boolean. Instead we just need to do x.v == 123. val bodyC = elaborateSheath(body)(s.state, e, e1) trace"Sheath Filter(qry) with $stateInfo in $qq becomes" andReturn { (Filter(ent1, e1, bodyC), s) diff --git a/quill-sql-test/src/test/scala/io/getquill/context/sql/AggregationSpec.scala b/quill-sql-test/src/test/scala/io/getquill/context/sql/AggregationSpec.scala index fedca52c96..84ebe17268 100644 --- a/quill-sql-test/src/test/scala/io/getquill/context/sql/AggregationSpec.scala +++ b/quill-sql-test/src/test/scala/io/getquill/context/sql/AggregationSpec.scala @@ -5,7 +5,7 @@ import io.getquill.norm.{DisablePhase, OptionalPhase} import io.getquill.{Literal, MirrorSqlDialect, SqlMirrorContext, TestEntities} import io.getquill.norm.ConfigList._ -class AggregationSpec extends Spec { +class AggregationSpec extends Spec { // case class Person(id: Int, name: String, age: Int) case class PersonOpt(name: Option[String], age: Int) diff --git a/quill-sql/src/test/scala/io/getquill/context/sql/idiom/SqlIdiomTestSpec.scala b/quill-sql/src/test/scala/io/getquill/context/sql/idiom/SqlIdiomTestSpec.scala index df59286dad..eeb9bded96 100644 --- a/quill-sql/src/test/scala/io/getquill/context/sql/idiom/SqlIdiomTestSpec.scala +++ b/quill-sql/src/test/scala/io/getquill/context/sql/idiom/SqlIdiomTestSpec.scala @@ -24,7 +24,7 @@ object SqlIdiomTestSpec { // System.setProperty("quill.trace.color", "true") // System.setProperty("quill.trace.quat", "full") // System.setProperty("quill.trace.types", "all") -// io.getquill.util.Messages.resetCache() +// io.getquill.util.Messages.resetCache() // val q = quote { for { @@ -32,8 +32,8 @@ object SqlIdiomTestSpec { v2 <- qr2.filter(_.i == v1) } yield (v1, v2) }.dynamic - ctx.run(q).string == - "SELECT i._1, x1.s, x1.i, x1.l, x1.o FROM (SELECT DISTINCT i.i AS _1 FROM TestEntity i) AS i, TestEntity2 x1 WHERE x1.i = i._1" + println(ctx.run(q).string) + // "SELECT i._1, x1.s, x1.i, x1.l, x1.o FROM (SELECT DISTINCT i.i AS _1 FROM TestEntity i) AS i, TestEntity2 x1 WHERE x1.i = i._1" } }