From 56ad9e0b4576e9410243249c367f45310d882328 Mon Sep 17 00:00:00 2001
From: Minglei Tu <tmlneu@gmail.com>
Date: Sun, 11 Dec 2016 16:51:12 +0800
Subject: [PATCH] scala v2.12 support (complement)

---
 .travis.yml                                   |  1 +
 .../slickpg/PgArgonautSupportSuite.scala      | 12 ++++++----
 .../slickpg/PgCirceJsonSupportSuite.scala     | 12 ++++++----
 .../slickpg/PgDateSupportJodaSuite.scala      |  9 +++++---
 .../slickpg/PgJson4sSupportSuite.scala        | 14 +++++++-----
 .../slickpg/PgPostGISSupportSuite.scala       |  8 ++++---
 .../slickpg/PgPlayJsonSupportSuite.scala      | 12 ++++++----
 .../slickpg/PgSprayJsonSupportSuite.scala     | 12 ++++++----
 build.sbt                                     |  4 ++--
 .../tminglei/slickpg/MyPostgresProfile.scala  | 22 ++++++++++---------
 .../slickpg/PgArraySupportSuite.scala         |  7 +++---
 .../slickpg/PgCompositeSupportSuite.scala     | 14 +++++-------
 .../tminglei/slickpg/PgEnumSupportSuite.scala |  9 +++++---
 .../tminglei/slickpg/PgTsqlSupportSuite.scala |  2 +-
 14 files changed, 83 insertions(+), 55 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6dd6ea22..c708d03e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ sudo: required
 language: scala
 scala:
    - 2.11.8
+   - 2.12.1
 jdk:
   - oraclejdk8
 before_install:
diff --git a/addons/argonaut/src/test/scala/com/github/tminglei/slickpg/PgArgonautSupportSuite.scala b/addons/argonaut/src/test/scala/com/github/tminglei/slickpg/PgArgonautSupportSuite.scala
index 6826f3c2..58f92515 100644
--- a/addons/argonaut/src/test/scala/com/github/tminglei/slickpg/PgArgonautSupportSuite.scala
+++ b/addons/argonaut/src/test/scala/com/github/tminglei/slickpg/PgArgonautSupportSuite.scala
@@ -13,17 +13,21 @@ import scala.concurrent.duration._
 class PgArgonautSupportSuite extends FunSuite {
   implicit val testExecContext = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(4))
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgArgonautSupport
                             with array.PgArrayJdbcTypes {
     override val pgjson = "jsonb"
 
-    override val api = new API with JsonImplicits {
-      implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
-    }
+    override val api: API = new API {}
 
     val plainAPI = new API with ArgonautJsonPlainImplicits
+
+    ///
+    trait API extends super.API with JsonImplicits {
+      implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
+    }
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/addons/circe-json/src/test/scala/com/github/tminglei/slickpg/PgCirceJsonSupportSuite.scala b/addons/circe-json/src/test/scala/com/github/tminglei/slickpg/PgCirceJsonSupportSuite.scala
index d886261d..784a66be 100644
--- a/addons/circe-json/src/test/scala/com/github/tminglei/slickpg/PgCirceJsonSupportSuite.scala
+++ b/addons/circe-json/src/test/scala/com/github/tminglei/slickpg/PgCirceJsonSupportSuite.scala
@@ -14,17 +14,21 @@ import scala.concurrent.duration._
 class PgCirceJsonSupportSuite extends FunSuite {
   implicit val testExecContext = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(4))
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgCirceJsonSupport
                             with array.PgArrayJdbcTypes {
     override val pgjson = "jsonb"
 
-    override val api = new API with JsonImplicits {
-      implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
-    }
+    override val api: API = new API {}
 
     val plainAPI = new API with CirceJsonPlainImplicits
+
+    ///
+    trait API extends super.API with JsonImplicits {
+      implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
+    }
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   import MyPostgresProfile.api._
 
diff --git a/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaSuite.scala b/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaSuite.scala
index c5f1d90d..00a558d6 100644
--- a/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaSuite.scala
+++ b/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaSuite.scala
@@ -11,14 +11,17 @@ import scala.concurrent.{Await, ExecutionContext}
 class PgDateSupportJodaSuite extends FunSuite {
   implicit val testExecContext = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(4))
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgDateSupportJoda {
 
-    override val api = new API with DateTimeImplicits
+    override val api: API = new API {}
 
-    ///
     val plainAPI = new API with JodaDateTimePlainImplicits
+
+    ///
+    trait API extends super.API with DateTimeImplicits
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/addons/json4s/src/test/scala/com/github/tminglei/slickpg/PgJson4sSupportSuite.scala b/addons/json4s/src/test/scala/com/github/tminglei/slickpg/PgJson4sSupportSuite.scala
index c828a7d3..cf8d77af 100644
--- a/addons/json4s/src/test/scala/com/github/tminglei/slickpg/PgJson4sSupportSuite.scala
+++ b/addons/json4s/src/test/scala/com/github/tminglei/slickpg/PgJson4sSupportSuite.scala
@@ -12,15 +12,20 @@ import scala.concurrent.duration._
 class PgJson4sSupportSuite extends FunSuite {
   implicit val testExecContext = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(4))
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgJson4sSupport
                             with array.PgArrayJdbcTypes {
     /// for json support
     override val pgjson = "jsonb"
-    type DOCType = text.Document
+    type DOCType = org.json4s.native.Document
     override val jsonMethods = org.json4s.native.JsonMethods.asInstanceOf[JsonMethods[DOCType]]
 
-    override val api = new API with JsonImplicits {
+    override val api: API = new API {}
+
+    val plainAPI = new API with Json4sJsonPlainImplicits
+
+    ///
+    trait API extends super.API with JsonImplicits {
       implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
       implicit val json4sJsonArrayTypeMapper =
         new AdvancedArrayJdbcType[JValue](pgjson,
@@ -28,9 +33,8 @@ class PgJson4sSupportSuite extends FunSuite {
           (v) => utils.SimpleArrayUtils.mkString[JValue](j=>jsonMethods.compact(jsonMethods.render(j)))(v)
         ).to(_.toList)
     }
-
-    val plainAPI = new API with Json4sJsonPlainImplicits
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/addons/jts/src/test/scala/com/github/tminglei/slickpg/PgPostGISSupportSuite.scala b/addons/jts/src/test/scala/com/github/tminglei/slickpg/PgPostGISSupportSuite.scala
index 39bebf15..e39acef5 100644
--- a/addons/jts/src/test/scala/com/github/tminglei/slickpg/PgPostGISSupportSuite.scala
+++ b/addons/jts/src/test/scala/com/github/tminglei/slickpg/PgPostGISSupportSuite.scala
@@ -13,13 +13,15 @@ import scala.concurrent.duration._
 class PgPostGISSupportSuite extends FunSuite {
   implicit val testExecContext = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(4))
 
-  object MyPostgresProfile extends PostgresProfile with PgPostGISSupport {
+  trait MyPostgresProfile extends PostgresProfile with PgPostGISSupport {
 
-    override val api = new API with PostGISImplicits with PostGISAssistants
+    override val api: API = new API {}
+    val plainAPI = new API with PostGISPlainImplicits
 
     ///
-    val plainAPI = new API with PostGISPlainImplicits
+    trait API extends super.API with PostGISImplicits with PostGISAssistants
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/addons/play-json/src/test/scala/com/github/tminglei/slickpg/PgPlayJsonSupportSuite.scala b/addons/play-json/src/test/scala/com/github/tminglei/slickpg/PgPlayJsonSupportSuite.scala
index 8fd2e957..7c310609 100644
--- a/addons/play-json/src/test/scala/com/github/tminglei/slickpg/PgPlayJsonSupportSuite.scala
+++ b/addons/play-json/src/test/scala/com/github/tminglei/slickpg/PgPlayJsonSupportSuite.scala
@@ -18,12 +18,17 @@ class PgPlayJsonSupportSuite extends FunSuite {
     implicit val jbeanWrt = Json.writes[JBean]
   }
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgPlayJsonSupport
                             with array.PgArrayJdbcTypes {
     override val pgjson = "jsonb"
 
-    override val api = new API with JsonImplicits {
+    override val api: API = new API {}
+
+    val plainAPI = new API with PlayJsonPlainImplicits
+
+    ///
+    trait API extends super.API with JsonImplicits {
       implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
       implicit val beanJsonTypeMapper = MappedJdbcType.base[JBean, JsValue](Json.toJson(_), _.as[JBean])
       implicit val jsonArrayTypeMapper =
@@ -37,9 +42,8 @@ class PgPlayJsonSupportSuite extends FunSuite {
           (v) => utils.SimpleArrayUtils.mkString[JBean](b => Json.stringify(Json.toJson(b)))(v)
         ).to(_.toList)
     }
-
-    val plainAPI = new API with PlayJsonPlainImplicits
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/addons/spray-json/src/test/scala/com/github/tminglei/slickpg/PgSprayJsonSupportSuite.scala b/addons/spray-json/src/test/scala/com/github/tminglei/slickpg/PgSprayJsonSupportSuite.scala
index 0be08ac2..d7d04537 100644
--- a/addons/spray-json/src/test/scala/com/github/tminglei/slickpg/PgSprayJsonSupportSuite.scala
+++ b/addons/spray-json/src/test/scala/com/github/tminglei/slickpg/PgSprayJsonSupportSuite.scala
@@ -17,19 +17,23 @@ class PgSprayJsonSupportSuite extends FunSuite {
     implicit val jbeanFormat = jsonFormat2(JBean)
   }
 
-  object MyPostgresProfile extends PostgresProfile
+  trait MyPostgresProfile extends PostgresProfile
                             with PgSprayJsonSupport
                             with array.PgArrayJdbcTypes {
     override val pgjson = "jsonb"
 
-    override val api = new API with JsonImplicits {
+    override val api: API = new API {}
+
+    val plainAPI = new API with SprayJsonPlainImplicits
+
+    ///
+    trait API extends super.API with JsonImplicits {
       import MyJsonProtocol._
       implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
       implicit val beanJsonTypeMapper = MappedJdbcType.base[JBean, JsValue](_.toJson, _.convertTo[JBean])
     }
-
-    val plainAPI = new API with SprayJsonPlainImplicits
   }
+  object MyPostgresProfile extends MyPostgresProfile
 
   ///
   import MyPostgresProfile.api._
diff --git a/build.sbt b/build.sbt
index 5fd31e87..d6f24575 100644
--- a/build.sbt
+++ b/build.sbt
@@ -2,9 +2,9 @@ lazy val commonSettings = Seq(
   organizationName := "slick-pg",
   organization := "com.github.tminglei",
   name := "slick-pg",
-  version := "0.15.0-M4",
+  version := "0.15.0-M3",
 
-  scalaVersion := "2.11.8",
+  scalaVersion := "2.12.1",
   crossScalaVersions := Seq("2.11.8", "2.12.1"),
   scalacOptions ++= Seq("-deprecation", "-feature",
     "-language:implicitConversions",
diff --git a/src/test/scala/com/github/tminglei/slickpg/MyPostgresProfile.scala b/src/test/scala/com/github/tminglei/slickpg/MyPostgresProfile.scala
index c31c4374..f3fb2569 100644
--- a/src/test/scala/com/github/tminglei/slickpg/MyPostgresProfile.scala
+++ b/src/test/scala/com/github/tminglei/slickpg/MyPostgresProfile.scala
@@ -13,16 +13,18 @@ trait MyPostgresProfile extends ExPostgresProfile
 
   override val pgjson = "jsonb"
   ///
-  override val api = new API with ArrayImplicits
-                             with SimpleDateTimeImplicits
-                             with DateTimeImplicits
-                             with SimpleJsonImplicits
-                             with NetImplicits
-                             with LTreeImplicits
-                             with RangeImplicits
-                             with HStoreImplicits
-                             with SearchImplicits
-                             with SearchAssistants {}
+  override val api: API = new API {}
+
+  trait API extends super.API with ArrayImplicits
+                              with SimpleDateTimeImplicits
+                              with DateTimeImplicits
+                              with SimpleJsonImplicits
+                              with NetImplicits
+                              with LTreeImplicits
+                              with RangeImplicits
+                              with HStoreImplicits
+                              with SearchImplicits
+                              with SearchAssistants
   ///
   val plainAPI = new API with SimpleArrayPlainImplicits
                          with Date2DateTimePlainImplicits
diff --git a/src/test/scala/com/github/tminglei/slickpg/PgArraySupportSuite.scala b/src/test/scala/com/github/tminglei/slickpg/PgArraySupportSuite.scala
index 0b15b66a..af104682 100644
--- a/src/test/scala/com/github/tminglei/slickpg/PgArraySupportSuite.scala
+++ b/src/test/scala/com/github/tminglei/slickpg/PgArraySupportSuite.scala
@@ -17,11 +17,11 @@ class PgArraySupportSuite extends FunSuite {
   case class Institution(value: Long)
   case class MarketFinancialProduct(value: String)
 
-  object MyPostgresProfile1 extends ExPostgresProfile with PgArraySupport {
-    override val api = new API with ArrayImplicits with MyArrayImplicitsPlus {}
+  trait MyPostgresProfile1 extends ExPostgresProfile with PgArraySupport {
+    override val api: API = new API {}
 
     ///
-    trait MyArrayImplicitsPlus {
+    trait API extends super.API with ArrayImplicits {
       implicit val simpleLongBufferTypeMapper = new SimpleArrayJdbcType[Long]("int8").to(_.toBuffer)
       implicit val simpleStrVectorTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toVector)
       implicit val institutionListTypeWrapper =  new SimpleArrayJdbcType[Long]("int8")
@@ -33,6 +33,7 @@ class PgArraySupportSuite extends FunSuite {
         fromString(identity)(_).orNull, mkString(identity))
     }
   }
+  object MyPostgresProfile1 extends MyPostgresProfile1
 
   //////////////////////////////////////////////////////////////////////////
   import MyPostgresProfile1.api._
diff --git a/src/test/scala/com/github/tminglei/slickpg/PgCompositeSupportSuite.scala b/src/test/scala/com/github/tminglei/slickpg/PgCompositeSupportSuite.scala
index dc18864e..9e666330 100644
--- a/src/test/scala/com/github/tminglei/slickpg/PgCompositeSupportSuite.scala
+++ b/src/test/scala/com/github/tminglei/slickpg/PgCompositeSupportSuite.scala
@@ -3,10 +3,8 @@ package com.github.tminglei.slickpg
 import org.postgresql.util.HStoreConverter
 import org.scalatest.FunSuite
 import slick.jdbc.{GetResult, PositionedResult, PostgresProfile}
-import slick.lifted.RepShapeImplicits
 
 import scala.collection.convert.{WrapAsJava, WrapAsScala}
-import scala.reflect.runtime.{universe => u}
 import java.sql.Timestamp
 import java.text.SimpleDateFormat
 
@@ -41,17 +39,13 @@ object PgCompositeSupportSuite {
     ) extends Struct
 
   //-------------------------------------------------------------
-  object MyPostgresProfile1 extends PostgresProfile with PgCompositeSupport with PgArraySupport with utils.PgCommonJdbcTypes {
-    override val api = new API with ArrayImplicits with CompositeImplicits {}
-
-    val plainImplicits = new API with CompositePlainImplicits {}
-
+  trait MyPostgresProfile1 extends PostgresProfile with PgCompositeSupport with PgArraySupport with utils.PgCommonJdbcTypes {
     def mapToString(m: Map[String, String]): String = HStoreConverter.toString(WrapAsJava.mapAsJavaMap(m))
     def stringToMap(s: String): Map[String, String] = WrapAsScala.mapAsScalaMap(HStoreConverter.fromString(s)
       .asInstanceOf[java.util.Map[String, String]]).toMap
 
     ///
-    trait CompositeImplicits {
+    trait API extends super.API with ArrayImplicits {
       utils.TypeConverters.register(PgRangeSupportUtils.mkRangeFn(ts))
       utils.TypeConverters.register(PgRangeSupportUtils.toStringFn[Timestamp](tsFormat.format))
       utils.TypeConverters.register(mapToString)
@@ -64,8 +58,9 @@ object PgCompositeSupportSuite {
       implicit val composite2ArrayTypeMapper = createCompositeArrayJdbcType[Composite2]("composite2").to(_.toList)
       implicit val composite3ArrayTypeMapper = createCompositeArrayJdbcType[Composite3]("composite3").to(_.toList)
     }
+    override val api: API = new API {}
 
-    trait CompositePlainImplicits extends SimpleArrayPlainImplicits {
+    val plainImplicits = new API with SimpleArrayPlainImplicits {
       import utils.PlainSQLUtils._
       // to support 'nextArray[T]/nextArrayOption[T]' in PgArraySupport
       {
@@ -96,6 +91,7 @@ object PgCompositeSupportSuite {
       implicit val composite3ArrayOptSetParameter = createCompositeOptionArraySetParameter[Composite3]("composite3")
     }
   }
+  object MyPostgresProfile1 extends MyPostgresProfile1
 }
 
 ///
diff --git a/src/test/scala/com/github/tminglei/slickpg/PgEnumSupportSuite.scala b/src/test/scala/com/github/tminglei/slickpg/PgEnumSupportSuite.scala
index 02d4d451..4a9f9a95 100644
--- a/src/test/scala/com/github/tminglei/slickpg/PgEnumSupportSuite.scala
+++ b/src/test/scala/com/github/tminglei/slickpg/PgEnumSupportSuite.scala
@@ -46,10 +46,12 @@ class PgEnumSupportSuite extends FunSuite {
   import WeekDays._
   import Rainbows._
 
-  object MyPostgresProfile1 extends PostgresProfile with PgEnumSupport {
-    override val api = new API with MyEnumImplicits {}
+  trait MyPostgresProfile1 extends PostgresProfile with PgEnumSupport {
 
-    trait MyEnumImplicits {
+    override val api: API = new API {}
+
+    ///
+    trait API extends super.API {
       implicit val weekDayTypeMapper = createEnumJdbcType("WeekDay", WeekDays)
       implicit val weekDayListTypeMapper = createEnumListJdbcType("weekDay", WeekDays)
       implicit val rainbowTypeMapper = createEnumJdbcType("Rainbow", Rainbows, true)
@@ -76,6 +78,7 @@ class PgEnumSupportSuite extends FunSuite {
       implicit val genderOptionColumnExtensionMethodsBuilder = createEnumOptionColumnExtensionMethodsBuilder[Gender]
     }
   }
+  object MyPostgresProfile1 extends MyPostgresProfile1
 
   ////////////////////////////////////////////////////////////////////
   import MyPostgresProfile1.api._
diff --git a/src/test/scala/com/github/tminglei/slickpg/PgTsqlSupportSuite.scala b/src/test/scala/com/github/tminglei/slickpg/PgTsqlSupportSuite.scala
index dce0ead6..199d73b2 100644
--- a/src/test/scala/com/github/tminglei/slickpg/PgTsqlSupportSuite.scala
+++ b/src/test/scala/com/github/tminglei/slickpg/PgTsqlSupportSuite.scala
@@ -3,7 +3,7 @@ package com.github.tminglei.slickpg
 import java.util.UUID
 
 import org.scalatest.FunSuite
-import slick.backend.StaticDatabaseConfig
+import slick.basic.StaticDatabaseConfig
 
 /*
  * NOTE: to check it, we need move `MyPostgresDriver.scala` from test folder to main folder