Skip to content

Commit

Permalink
Fix error introduced in removing existentials (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
d6y authored Aug 15, 2019
1 parent 8e324ee commit da2c4af
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ organization := "io.underscore"
version := "0.3.6-SNAPSHOT"
scalaVersion := "2.13.0"

crossScalaVersions := Seq("2.11.12", "2.12.8", "2.13.0")
crossScalaVersions := Seq("2.11.12", "2.12.9", "2.13.0")

licenses += ("Apache-2.0", url("http://apache.org/licenses/LICENSE-2.0"))

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/slickless/HListShape.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait HListShapeImplicits {
new HListShape(Nil)

implicit def hconsShape[
L <: ShapeLevel, L1 <: L, L2 <: L,
L <: ShapeLevel, L1 <: ShapeLevel, L2 <: ShapeLevel,
M1, M2 <: HList,
U1, U2 <: HList,
P1, P2 <: HList
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/slickless/NestedSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class NestedSpec extends Spec {
val emp = Employee(1L, Department(42L, "Brighton"), "[email protected]")

val action = for {
_ <- emps.schema.drop.asTry
_ <- emps.schema.create
_ <- emps += emp
ans <- emps.result.head
Expand Down
46 changes: 46 additions & 0 deletions src/test/scala/userapp/Issue42.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import slickless.Spec
import shapeless.{HNil, Generic}
import slick.jdbc.H2Profile.api._
import slickless._
import scala.concurrent.ExecutionContext.Implicits.global

class Issue42 extends Spec {

case class Department(id: Long, city: String)

case class Employee(id: Long, dept1: Department, dept2: Department, email: String)

class Employees(tag: Tag) extends Table[Employee](tag, "emps42") {
def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
def departmentIdA = column[Long]("dept_a_id")
def departmentCityA = column[String]("dept_a_city")
def departmentIdB = column[Long]("dept_b_id")
def departmentCityB = column[String]("dept_b_city")
def email = column[String]("email")

def departmentA = (departmentIdA, departmentCityA).mapTo[Department]
def departmentB = (departmentIdB, departmentCityB).mapTo[Department]

def * = (id :: departmentA :: departmentB :: email :: HNil).mappedWith(Generic[Employee])
}

lazy val emps = TableQuery[Employees]

"slick tables with nested case class mappings" - {
"should support inserts and selects" in {
val db = Database.forConfig("h2")

val emp = Employee(1L, Department(21L, "Brighton"), Department(22L, "Hove"), "[email protected]")

val action = for {
_ <- emps.schema.drop.asTry
_ <- emps.schema.create
_ <- emps += emp
ans <- emps.result.head
_ <- emps.schema.drop
} yield ans

whenReady(db.run(action)) { _ should equal(emp) }
}
}
}

0 comments on commit da2c4af

Please sign in to comment.