Closed mdedetrich closed 4 years ago
No, it's really not an issue with Slick! :-D
No, it's really not an issue with Slick! :-D
Alrighty then!
slick 3.2.0-M1 already has a macro mapTo
to do this more simply. Have a try?
https://github.com/slick/slick/pull/1306
slick 3.2.0-M1 already has a macro mapTo to do this more simply. Have a try?
Thanks will try it, although @milessabin still wanted me to report this issue because its a problem with shapeless that he wants to try and solve
Hi. No plan to fix this? I recently encountered this problem. The complier hangs!
I believe this is an issue with slickless. I blame slick for using existential phantom types :ghost: See scala/bug#10420 and my comment
@hamidr there's very much a plan: the fix is in the compiler ... see my work on byname implicit arguments and induction heuristics.
@milessabin in @mdedetrich's example I believe existential types are to blame. See underscoreio/slickless#20
@hamidr did you experience the exact same problem or some other instance of slow compilation times?
Thank you folks for quick response. I found out apparently I was mentioning a column in the fields which was not part of the case class itself so the compiler(scalac) in my experience didn't stop compiling at all, I waited almost half an hour to see where it goes then I got tired and killed it. I tried typelevel-scala compiler it had the same problem but with one difference which was an error that i am going to explain and hope it would help you to solve this problem - I am not sure if its fixable! -. So here is my case:
package Booking.Infrastructure
import java.sql.Timestamp
import java.sql.Date
import Booking.Entities.BookingEntities._
import Booking.Objects.CurrenciesEnum
import models.Objects.BookingEnum.BookingStateEnum
import play.api.libs.json.JsValue
import ptpUtils.PostgresDriver.api._
object BookingComponent {
object Implicits {
implicit val myEnumMapper1 = MappedColumnType.base[CurrenciesEnum.CurrenciesEnum, String](
e => e.toString,
s => CurrenciesEnum.withName(s)
)
implicit val myEnumMapper2 = MappedColumnType.base[BookingStateEnum.BookingStateEnum, String](
e => e.toString,
s => BookingStateEnum.withName(s)
)
}
import Implicits._
class BookingTable(tag: Tag) extends Table[BookingFO](tag, "booking") {
def id: Rep[Long] = column[Long]("id", O.AutoInc, O.PrimaryKey)
def randomId: Rep[String] = column[String]("random_id")
def shopRandomId: Rep[String] = column[String]("shop_random_id")
def registeredDate: Rep[Timestamp] = column[Timestamp]("registered_date")
def updateDate: Rep[Option[Timestamp]] = column[Option[Timestamp]]("update_date")
def dateFrom: Rep[Date] = column[Date]("date_from")
def dateTo: Rep[Date] = column[Date]("date_to")
def state: Rep[BookingStateEnum.BookingStateEnum] =
column[BookingStateEnum.BookingStateEnum]("state")
def adultCount: Rep[Option[Int]] = column[Option[Int]]("adult_count")
def childCount: Rep[Option[Int]] = column[Option[Int]]("child_count")
def infantCount: Rep[Option[Int]] = column[Option[Int]]("infant_count")
def hotelId: Rep[Long] = column[Long]("hotel_id")
def userId: Rep[Long] = column[Long]("user_id")
def shopId: Rep[Option[Long]] = column[Option[Long]]("shop_id")
def hotelConfirmationCode: Rep[Option[String]] = column[Option[String]]("hotel_confirmation_code")
def providerBookId: Rep[Option[String]] = column[Option[String]]("provider_book_id")
def roomProvider: Rep[Option[String]] = column[Option[String]]("room_provider")
def specialRequests: Rep[Option[String]] = column[Option[String]]("special_requests")
def travelType: Rep[Option[String]] = column[Option[String]]("travel_type")
def operatorId: Rep[Option[Long]] = column[Option[Long]]("operator_id")
def reservationType: Rep[String] = column[String]("reservation_type")
def registrarId: Rep[Option[Long]] = column[Option[Long]]("registrar_id")
def creditPaymentDate: Rep[Option[Date]] = column[Option[Date]]("credit_payment_date")
def price: Rep[Float] = column[Float]("price")
def discount: Rep[Float] = column[Float]("discount")
def finalPrice: Rep[Float] = column[Float]("final_price")
def paymentFee: Rep[Option[Float]] = column[Option[Float]]("payment_fee")
def buyPrice: Rep[Option[Float]] = column[Option[Float]]("buy_price")
def currencyUnit: Rep[CurrenciesEnum.CurrenciesEnum] =
column[CurrenciesEnum.CurrenciesEnum]("currency_unit")
def paymentCurrencyUnit: Rep[CurrenciesEnum.CurrenciesEnum] =
column[CurrenciesEnum.CurrenciesEnum]("payment_currency_unit")
def extraBedFee: Rep[Option[Float]] = column[Option[Float]]("extra_bed_fee")
def childFee: Rep[Option[Float]] = column[Option[Float]]("child_fee")
def infantFee: Rep[Option[Float]] = column[Option[Float]]("infant_fee")
def buyPriceAuto: Rep[Option[Long]] = column[Option[Long]]("buy_price_auto")
def cashableCredit: Rep[Option[Float]] = column[Option[Float]]("cashable_credit")
def uncashableCredit: Rep[Option[Float]] = column[Option[Float]]("uncashable_credit")
def clearedWithHotel: Rep[Option[Boolean]] = column[Option[Boolean]]("cleared_with_hotel")
def clearanceDate: Rep[Option[Date]] = column[Option[Date]]("clearance_date")
def cancelRefundCustomerPrice: Rep[Option[Float]] = column[Option[Float]]("cancel_refund_customer_price")
def cancelRefundHotelPrice: Rep[Option[Float]] = column[Option[Float]]("cancel_refund_hotel_price")
def invoiceState: Rep[Option[String]] = column[Option[String]]("invoice_state")
def discountCodeValue: Rep[Option[Float]] = column[Option[Float]]("discount_code_value")
def discountCode: Rep[Option[String]] = column[Option[String]]("discount_code")
def invoiceSerial: Rep[Option[String]] = column[Option[String]]("invoice_serial")
def availability: Rep[Option[Int]] = column[Option[Int]]("availability")
def merchant: Rep[String] = column[String]("merchant")
def usesGuarantee: Rep[Option[Boolean]] = column[Option[Boolean]]("uses_guarantee")
def app: Rep[Option[String]] = column[Option[String]]("app")
def providerBookingState: Rep[Option[String]] = column[Option[String]]("provider_booking_state")
def providerTripId: Rep[Option[String]] = column[Option[String]]("provider_trip_id")
def providerBookingId: Rep[Option[String]] = column[Option[String]]("provider_booking_id")
def sessionId: Rep[Option[String]] = column[Option[String]]("provider_session_id")
def providerHotelCode: Rep[Option[String]] = column[Option[String]]("provider_hotel_id")
def resultIndex: Rep[Option[Int]] = column[Option[Int]]("provider_result_index")
def clientReferenceNumber: Rep[Option[String]] = column[Option[String]]("client_reference_number")
def providerCancelPolicy: Rep[Option[JsValue]] = column[Option[JsValue]]("provider_cancel_policy")
def userName: Rep[Option[String]] = column[Option[String]]("username")
def userGuestInfo: Rep[Option[JsValue]] = column[Option[JsValue]]("user_guest_info")
def currencyBook: Rep[Option[JsValue]] = column[Option[JsValue]]("currency_book")
import shapeless._
import slickless._
def * =
(id :: randomId :: shopRandomId :: registeredDate :: updateDate :: dateFrom :: dateTo :: state ::
adultCount :: childCount :: infantCount :: hotelId :: userId :: shopId :: hotelConfirmationCode ::
providerBookId :: roomProvider :: specialRequests :: travelType :: operatorId :: reservationType ::
registrarId :: clientReferenceNumber :: creditPaymentDate :: price :: discount :: finalPrice ::
paymentFee :: buyPrice :: currencyUnit :: paymentCurrencyUnit :: extraBedFee :: childFee :: infantFee ::
buyPriceAuto :: cashableCredit :: uncashableCredit :: clearedWithHotel :: clearanceDate ::
cancelRefundCustomerPrice :: cancelRefundHotelPrice :: invoiceState :: discountCodeValue :: discountCode ::
invoiceSerial :: availability :: merchant :: usesGuarantee :: app :: providerBookingState :: providerTripId ::
providerBookingId :: sessionId :: providerHotelCode :: resultIndex :: providerCancelPolicy :: userName ::
userGuestInfo :: currencyBook :: HNil).mappedWith(Generic[BookingFO])
}
}
and my case class:
case class BookingFO(
id: Long = 0L,
randomId: String,
shopRandomId: String,
registeredDate: Timestamp,
updateDate: Option[Timestamp] = None,
dateFrom: Date,
dateTo: Date,
state: BookingStateEnum.BookingStateEnum = BookingStateEnum.draft,
adultCount: Option[Int] = None,
childCount: Option[Int] = None,
infantCount: Option[Int] = None,
hotelId: Long,
userId: Long,
shopId: Option[Long],
hotelConfirmationCode: Option[String] = None,
providerBookId: Option[String] = None,
roomProvider: Option[String] = None,
specialRequests: Option[String] = None,
travelType: Option[String] = None,
operatorId: Option[Long] = None,
reservationType: String,
registrarId: Option[Long] = None,
clientReferenceNumber: Option[String] = Some(""),
creditPaymentDate: Option[Date] = None,
price: Float,
discount: Float,
finalPrice: Float,
paymentFee: Option[Float] = None,
buyPrice: Option[Float] = None,
currencyUnit: CurrenciesEnum.CurrenciesEnum,
paymentCurrencyUnit: CurrenciesEnum.CurrenciesEnum,
extraBedFee: Option[Float] = None,
childFee: Option[Float] = None,
infantFee: Option[Float] = None,
buyPriceAuto: Option[Long] = None,
cashableCredit: Option[Float] = None,
uncashableCredit: Option[Float] = None,
clearedWithHotel: Option[Boolean] = None,
clearanceDate: Option[Date] = None,
cancelRefundCustomerPrice: Option[Float] = None,
cancelRefundHotelPrice: Option[Float] = None,
invoiceState: Option[String] = None,
discountCodeValue: Option[Float] = None,
discountCode: Option[String] = None,
invoiceSerial: Option[String] = None,
availability: Option[Int] = None,
merchant: String,
usesGuarantee: Option[Boolean] = None,
app: Option[String] = None,
providerBookingState: Option[String] = Some("initialized"),
providerTripId: Option[String] = None,
providerBookingId: Option[String] = None,
sessionId: Option[String] = None,
providerHotelCode: Option[String] = None,
resultIndex: Option[Int] = None,
providerCancelPolicy: Option[JsValue] = None,
userName: Option[String] = Some(""),
userGuestInfo: Option[JsValue] = None,
currencyBook: Option[JsValue] = None,
)
I found out that, this particular change doesn't give an error in scalac but it prompts an error scala-typelevel.
diff --git a/app/ptpUtils/PostgresDriver.scala b/app/ptpUtils/PostgresDriver.scala
index a5a8d98..22df3b2 100644
--- a/app/ptpUtils/PostgresDriver.scala
+++ b/app/ptpUtils/PostgresDriver.scala
@@ -2,30 +2,13 @@ package ptpUtils
import com.github.tminglei.slickpg._
-trait PostgresDriver extends ExPostgresProfile
- with PgArraySupport
- with PgDate2Support
- with PgPlayJsonSupport
- with PgNetSupport
- with PgLTreeSupport
- with PgRangeSupport
- with PgPostGISSupport
- with PgHStoreSupport
- with PgSearchSupport {
+case object PostgresDriver
+ extends ExPostgresProfile with PgArraySupport with PgDate2Support with PgPlayJsonSupport with PgNetSupport
+ with PgLTreeSupport with PgRangeSupport with PgPostGISSupport with PgHStoreSupport with PgSearchSupport {
override val pgjson = "jsonb"
///
- override val api = new API with ArrayImplicits
- with DateTimeImplicits
- with PlayJsonImplicits
- with NetImplicits
- with LTreeImplicits
- with PostGISImplicits
- with PostGISPlainImplicits
- with RangeImplicits
- with HStoreImplicits
- with SearchImplicits
- with SearchAssistants {}
+ override val api = new API with ArrayImplicits with DateTimeImplicits with PlayJsonImplicits with NetImplicits
+ with LTreeImplicits with PostGISImplicits with PostGISPlainImplicits with RangeImplicits with HStoreImplicits
+ with SearchImplicits with SearchAssistants {}
}
-
-object PostgresDriver extends PostgresDriver
the error itself was:
[error] Error while emitting PostgresDriver.scala
[error] assertion failed:
[error] Trying to access the this of another class: tree.symbol = trait PostgresDriver, class symbol = <$anon: com.github.tminglei.slickpg.ExPostgresProfile$API with com.github.tminglei.slickpg.PgArraySupport$ArrayImplicits with com.github.tminglei.slickpg.PgDate2Support$DateTimeImplicits with com.github.tminglei.slickpg.PgPlayJsonSupport$PlayJsonImplicits with com.github.tminglei.slickpg.PgNetSupport$NetImplicits with com.github.tminglei.slickpg.PgLTreeSupport$LTreeImplicits with com.github.tminglei.slickpg.PgPostGISSupport$PostGISImplicits with com.github.tminglei.slickpg.PgPostGISSupport$PostGISPlainImplicits with com.github.tminglei.slickpg.PgRangeSupport$RangeImplicits with com.github.tminglei.slickpg.PgHStoreSupport$HStoreImplicits with com.github.tminglei.slickpg.PgSearchSupport$SearchImplicits with com.github.tminglei.slickpg.PgSearchSupport$SearchAssistants> compilation unit: PostgresDriver.scala
[error] while compiling: /home/hamid/projects/hotelbooking-service/app/ptpUtils/PostgresDriver.scala
[error] during phase: jvm
[error] library version: version 2.12.4-bin-typelevel-4
[error] compiler version: version 2.12.4-bin-typelevel-4
[error] reconstructed args: -encoding utf8 -Yliteral-types -deprecation -Xstrict-patmat-analysis -Xlint:strict-unsealed-patmat -Ypartial-unification -Yinduction-heuristics -classpath /home/hamid/projects/hotelbooking-service/target/scala-2.12/classes:/home/hamid/.ivy2/cache/com.typesafe.play/twirl-api_2.12/jars/twirl-api_2.12-1.3.12.jar:/home/hamid/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-server_2.12/jars/play-server_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play_2.12/jars/play_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/build-link/jars/build-link-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-exceptions/jars/play-exceptions-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-netty-utils/jars/play-netty-utils-2.6.6.jar:/home/hamid/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.25.jar:/home/hamid/.ivy2/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.7.25.jar:/home/hamid/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.25.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-streams_2.12/jars/play-streams_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/org.reactivestreams/reactive-streams/jars/reactive-streams-1.0.1.jar:/home/hamid/.ivy2/cache/com.typesafe.akka/akka-stream_2.12/jars/akka-stream_2.12-2.5.4.jar:/home/hamid/.ivy2/cache/com.typesafe.akka/akka-actor_2.12/jars/akka-actor_2.12-2.5.4.jar:/home/hamid/.ivy2/cache/com.typesafe/config/bundles/config-1.3.1.jar:/home/hamid/.ivy2/cache/org.scala-lang.modules/scala-java8-compat_2.12/bundles/scala-java8-compat_2.12-0.8.0.jar:/home/hamid/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12/bundles/scala-parser-combinators_2.12-1.0.6.jar:/home/hamid/.ivy2/cache/com.typesafe.akka/akka-slf4j_2.12/jars/akka-slf4j_2.12-2.5.4.jar:/home/hamid/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.8.10.jar:/home/hamid/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.8.10.jar:/home/hamid/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.8.10.jar:/home/hamid/.ivy2/cache/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/bundles/jackson-datatype-jdk8-2.8.10.jar:/home/hamid/.ivy2/cache/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/bundles/jackson-datatype-jsr310-2.8.10.jar:/home/hamid/.ivy2/cache/commons-codec/commons-codec/jars/commons-codec-1.10.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-json_2.12/jars/play-json_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-functional_2.12/jars/play-functional_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/org.typelevel/scala-reflect/jars/scala-reflect-2.12.4-bin-typelevel-4.jar:/home/hamid/.ivy2/cache/org.typelevel/macro-compat_2.12/jars/macro-compat_2.12-1.1.1.jar:/home/hamid/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.9.9.jar:/home/hamid/.ivy2/cache/com.google.guava/guava/bundles/guava-22.0.jar:/home/hamid/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-1.3.9.jar:/home/hamid/.ivy2/cache/com.google.errorprone/error_prone_annotations/jars/error_prone_annotations-2.0.18.jar:/home/hamid/.ivy2/cache/com.google.j2objc/j2objc-annotations/jars/j2objc-annotations-1.1.jar:/home/hamid/.ivy2/cache/org.codehaus.mojo/animal-sniffer-annotations/jars/animal-sniffer-annotations-1.14.jar:/home/hamid/.ivy2/cache/io.jsonwebtoken/jjwt/jars/jjwt-0.7.0.jar:/home/hamid/.ivy2/cache/org.apache.commons/commons-lang3/jars/commons-lang3-3.6.jar:/home/hamid/.ivy2/cache/javax.transaction/jta/jars/jta-1.1.jar:/home/hamid/.ivy2/cache/javax.inject/javax.inject/jars/javax.inject-1.jar:/home/hamid/.ivy2/cache/com.typesafe.play/filters-helpers_2.12/jars/filters-helpers_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-logback_2.12/jars/play-logback_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.jar:/home/hamid/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.2.3.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-akka-http-server_2.12/jars/play-akka-http-server_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.akka/akka-http-core_2.12/jars/akka-http-core_2.12-10.0.10.jar:/home/hamid/.ivy2/cache/com.typesafe.akka/akka-parsing_2.12/jars/akka-parsing_2.12-10.0.10.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-guice_2.12/jars/play-guice_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.google.inject/guice/jars/guice-4.1.0.jar:/home/hamid/.ivy2/cache/aopalliance/aopalliance/jars/aopalliance-1.0.jar:/home/hamid/.ivy2/cache/com.google.inject.extensions/guice-assistedinject/jars/guice-assistedinject-4.1.0.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-openid_2.12/jars/play-openid_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ahc-ws_2.12/jars/play-ahc-ws_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ws_2.12/jars/play-ws_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ws-standalone_2.12/jars/play-ws-standalone_2.12-1.1.2.jar:/home/hamid/.ivy2/cache/com.typesafe/ssl-config-core_2.12/bundles/ssl-config-core_2.12-0.2.2.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ws-standalone-xml_2.12/jars/play-ws-standalone-xml_2.12-1.1.2.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ws-standalone-json_2.12/jars/play-ws-standalone-json_2.12-1.1.2.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ahc-ws-standalone_2.12/jars/play-ahc-ws-standalone_2.12-1.1.2.jar:/home/hamid/.ivy2/cache/com.typesafe.play/cachecontrol_2.12/jars/cachecontrol_2.12-1.1.2.jar:/home/hamid/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.7.jar:/home/hamid/.ivy2/cache/com.typesafe.play/shaded-asynchttpclient/jars/shaded-asynchttpclient-1.1.2.jar:/home/hamid/.ivy2/cache/com.typesafe.play/shaded-oauth/jars/shaded-oauth-1.1.2.jar:/home/hamid/.ivy2/cache/javax.cache/cache-api/jars/cache-api-1.0.0.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-ehcache_2.12/jars/play-ehcache_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-cache_2.12/jars/play-cache_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/net.sf.ehcache/ehcache/jars/ehcache-2.10.4.jar:/home/hamid/.ivy2/cache/org.ehcache/jcache/jars/jcache-1.0.1.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-jdbc-evolutions_2.12/jars/play-jdbc-evolutions_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-jdbc-api_2.12/jars/play-jdbc-api_2.12-2.6.6.jar:/home/hamid/.ivy2/cache/org.typelevel/cats-core_2.12/jars/cats-core_2.12-1.0.1.jar:/home/hamid/.ivy2/cache/org.typelevel/cats-macros_2.12/jars/cats-macros_2.12-1.0.1.jar:/home/hamid/.ivy2/cache/org.typelevel/machinist_2.12/jars/machinist_2.12-0.6.2.jar:/home/hamid/.ivy2/cache/org.typelevel/cats-kernel_2.12/jars/cats-kernel_2.12-1.0.1.jar:/home/hamid/.ivy2/cache/com.chuusai/shapeless_2.12/bundles/shapeless_2.12-2.3.3.jar:/home/hamid/.ivy2/cache/io.underscore/slickless_2.12/jars/slickless_2.12-0.3.2.jar:/home/hamid/.ivy2/cache/org.postgresql/postgresql/bundles/postgresql-42.1.4.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-iteratees_2.12/jars/play-iteratees_2.12-2.6.1.jar:/home/hamid/.ivy2/cache/org.scala-stm/scala-stm_2.12/jars/scala-stm_2.12-0.8.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-iteratees-reactive-streams_2.12/jars/play-iteratees-reactive-streams_2.12-2.6.1.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-slick_2.12/jars/play-slick_2.12-3.0.1.jar:/home/hamid/.ivy2/cache/com.typesafe.slick/slick_2.12/bundles/slick_2.12-3.2.1.jar:/home/hamid/.ivy2/cache/com.typesafe.slick/slick-hikaricp_2.12/bundles/slick-hikaricp_2.12-3.2.1.jar:/home/hamid/.ivy2/cache/com.zaxxer/HikariCP/bundles/HikariCP-2.5.1.jar:/home/hamid/.ivy2/cache/com.typesafe.play/play-slick-evolutions_2.12/jars/play-slick-evolutions_2.12-3.0.1.jar:/home/hamid/.ivy2/cache/com.github.tototoshi/play-json-naming_2.11/jars/play-json-naming_2.11-1.2.0.jar:/home/hamid/.ivy2/cache/com.vividsolutions/jts/jars/jts-1.13.jar:/home/hamid/.ivy2/cache/com.github.tminglei/slick-pg_2.12/jars/slick-pg_2.12-0.15.4.jar:/home/hamid/.ivy2/cache/com.github.tminglei/slick-pg_core_2.12/jars/slick-pg_core_2.12-0.15.4.jar:/home/hamid/.ivy2/cache/com.github.tminglei/slick-pg_json4s_2.12/jars/slick-pg_json4s_2.12-0.15.4.jar:/home/hamid/.ivy2/cache/org.json4s/json4s-ast_2.12/jars/json4s-ast_2.12-3.5.0.jar:/home/hamid/.ivy2/cache/org.json4s/json4s-core_2.12/jars/json4s-core_2.12-3.5.0.jar:/home/hamid/.ivy2/cache/org.json4s/json4s-scalap_2.12/jars/json4s-scalap_2.12-3.5.0.jar:/home/hamid/.ivy2/cache/com.thoughtworks.paranamer/paranamer/bundles/paranamer-2.8.jar:/home/hamid/.ivy2/cache/com.github.tminglei/slick-pg_jts_2.12/jars/slick-pg_jts_2.12-0.15.4.jar:/home/hamid/.ivy2/cache/com.github.tminglei/slick-pg_play-json_2.12/jars/slick-pg_play-json_2.12-0.15.4.jar -unchecked -bootclasspath /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre/classes:/home/hamid/.ivy2/cache/org.typelevel/scala-library/jars/scala-library-2.12.4-bin-typelevel-4.jar
Also my build.sbt:
name := """HotelBooking-Service"""
version := "0.1"
inThisBuild(Seq(
scalaOrganization := "org.typelevel",
scalaVersion := "2.12.4-bin-typelevel-4"
))
scalacOptions ++= Seq(
"-Yinduction-heuristics", // speeds up the compilation of inductive implicit resolution
"-Ypartial-unification",
// "-Ykind-polymorphism", // type and method definitions with type parameters of arbitrary kinds
"-Yliteral-types", // literals can appear in type position
"-Xstrict-patmat-analysis", // more accurate reporting of failures of match exhaustivity
"-Xlint:strict-unsealed-patmat" // warn on inexhaustive matches against unsealed traits
)
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
guice,
openId,
ehcache,
ws,
evolutions,
filters,
//cats
"org.typelevel" %% "cats-core" % "1.0.1",
"com.chuusai" %% "shapeless" % "2.3.3",
"io.underscore" %% "slickless" % "0.3.2",
"org.postgresql" % "postgresql" % "42.1.4",
"com.typesafe.play" %% "play-json" % "2.6.6",
"com.typesafe.play" %% "play-iteratees" % "2.6.1",
"com.typesafe.play" %% "play-iteratees-reactive-streams" % "2.6.1",
"com.typesafe.play" %% "play-slick" % "3.0.1",
"com.typesafe.play" %% "play-slick-evolutions" % "3.0.1",
"com.github.tototoshi" % "play-json-naming_2.11" % "1.2.0",
"com.vividsolutions" % "jts" % "1.13",
"com.github.tminglei" %% "slick-pg" % "0.15.4",
"com.github.tminglei" %% "slick-pg_json4s" % "0.15.4",
"com.github.tminglei" %% "slick-pg_jts" % "0.15.4",
"com.github.tminglei" %% "slick-pg_play-json" % "0.15.4",
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % "test",
"org.mockito" % "mockito-core" % "2.10.0" % "test",
)
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
// this packages will be ignore in coverage report
coverageExcludedPackages := """<empty>;Reverse.*;.*AuthService.*;models\.data\..*;views\..*;router.*;"""
@milessabin Thanks for the "-Yinduction-heuristics". It decreased the compilation time at least by 20%. @joroKr21 Not really. This was the only compile problem I had since I was only experimenting over shapeless ;) Btw the compiler doesn't hang anymore since I found out the problem but if I mistakenly add a new column to the Projection which is not part of the case class the compiler hanging thing happens again in both scalac and typelevel-scala(2.12.4).
@hamidr indeed this looks like the exact same problem. Can you check that underscoreio/slickless#20 solves it (i.e. compilation with the wrong field should fail much faster)? Slickless is just one file that you can copy in your project. Your example has too many dependencies for me to check ATM.
@joroKr21 it worked like a charm! thanks.
Just for the sake of information: I added a new column to the projection but not to the case class to expect a failure.
[info] Compiling 1 Scala source to /home/hamid/projects/hotelbooking-service/target/scala-2.12/classes ...
[error] /home/hamid/projects/hotelbooking-service/app/Booking/Infrastructure/BookingComponent.scala:104:80: No matching Shape found.
[error] Slick does not know how to map the given types.
[error] Possible causes: T in Table[T] does not match your * projection,
[error] you use an unsupported type in a Query (e.g. scala List),
[error] or you forgot to import a driver api into scope.
[error] Required level: L
[error] Source type: ptpUtils.PostgresDriver.api.Rep[Long] :: ptpUtils.PostgresDriver.api.Rep[String] :: ptpUtils.PostgresDriver.api.Rep[String] :: ptpUtils.PostgresDriver.api.Rep[java.sql.Timestamp] :: ptpUtils.PostgresDriver.api.Rep[Option[java.sql.Timestamp]] :: ptpUtils.PostgresDriver.api.Rep[java.sql.Date] :: ptpUtils.PostgresDriver.api.Rep[java.sql.Date] :: ptpUtils.PostgresDriver.api.Rep[models.Objects.BookingEnum.BookingStateEnum.BookingStateEnum] :: ptpUtils.PostgresDriver.api.Rep[Option[Int]] :: ptpUtils.PostgresDriver.api.Rep[Option[Int]] :: ptpUtils.PostgresDriver.api.Rep[Option[Int]] :: ptpUtils.PostgresDriver.api.Rep[Long] :: ptpUtils.PostgresDriver.api.Rep[Long] :: ptpUtils.PostgresDriver.api.Rep[Option[Long]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[Long]] :: ptpUtils.PostgresDriver.api.Rep[String] :: ptpUtils.PostgresDriver.api.Rep[Option[Long]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[java.sql.Date]] :: ptpUtils.PostgresDriver.api.Rep[Float] :: ptpUtils.PostgresDriver.api.Rep[Float] :: ptpUtils.PostgresDriver.api.Rep[Float] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Booking.Objects.CurrenciesEnum.CurrenciesEnum] :: ptpUtils.PostgresDriver.api.Rep[Booking.Objects.CurrenciesEnum.CurrenciesEnum] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Long]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Boolean]] :: ptpUtils.PostgresDriver.api.Rep[Option[java.sql.Date]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[Float]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[String]] :: ptpUtils.PostgresDriver.api.Rep[Option[Int]] :: ptpUtils.PostgresDriver.api.Rep[String] :: ptpUtils.PostgresDriver.api.Rep[Option[...]] :: ptpUtils.PostgresDriver.api.Rep[...] :: ... :: ...
[error] Unpacked type: this.Repr
[error] Packed type: P
[error] userGuestInfo :: currencyBook :: usedAvailabiltyIds :: HNil).mappedWith(Generic[BookingFO])
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 13 s, completed Jan 25, 2018 2:51:12 PM
Fixed in slickless by underscoreio/slickless#20
When using slick + shapeless (via the usage of slickless https://github.com/underscoreio/slickless), if you accidentally get an incorrect mapping (which can happen with really large case class) the compiler takes a REALLY long amount of time to report an error (at least 10 minutes in my personal use case)
According to @milessabin this is an issue with slick itself.
Sample project is shown below
https://github.com/mdedetrich/coffee-drinking-slow-slickless-compile