Skip to content
Permalink
Browse files

Fill typing holes in hoistClientOps

Fixes #1170. Test in UnionTest.testOptionUnion.
  • Loading branch information
szeiger committed Aug 27, 2015
1 parent 96abde0 commit 8b28a1d082af008809381e596526171554e5666d
@@ -105,4 +105,29 @@ class UnionTest extends AsyncTest[RelationalTestDB] {
q3.result.map(r => r.toSet shouldBe Set((10L, 1L), (20L, 2L), (30L, 3L), (100L, 1L), (200L, 2L), (300L, 3L)))
)
}

def testOptionUnion = {
case class Article(id: String, name: String)
class ArticleTable(tag: Tag) extends Table[Article](tag, "testOptionUnion") {
def id = column[String]("id")
def name = column[String]("name")

def * = (id, name) <> (Article.tupled, Article.unapply)
}
val table = TableQuery[ArticleTable]

val q1 = for {
t <- table
} yield (t, t.id.?)

val q2 = for {
t <- table
} yield (t, t.id.?)

val q3 = q1.unionAll(q2)
DBIO.seq(
table.schema.create,
q3.result
)
}
}
@@ -20,7 +20,7 @@ class HoistClientOps extends Phase {
val base = new AnonSymbol
val proj = ProductNode(ch.map { case (sym, _) => Select(Ref(base), sym) })
val t2 = ResultSetMapping(base, withStruct, proj)
val t3 = hoist(t2)
val t3 = hoist(t2).nodeWithComputedType(typeChildren = true)
val (rsmFrom, rsmProj) =
if(t3 eq t2) {
// Use original ProductNode form

0 comments on commit 8b28a1d

Please sign in to comment.
You can’t perform that action at this time.