Tuesday, 15 March 2011

Scala Compiler 2.10.4 fails to compile HList model using Slick 2.0, but sometimes it works. Why? -



Scala Compiler 2.10.4 fails to compile HList model using Slick 2.0, but sometimes it works. Why? -

i next compilation error using hlist slick2.0. of time error, don't error. note using scala ide 3.0.3 , not compliation error in eclipse ( unusual ). tried close jvm processes before running sbt clean compile, still same compilation error, although intermittently:

$ sbt clean compile [info] resolving org.scoverage#scalac-scoverage-plugin_2.10;0.99.5 ... [info] done updating. [error] ...../app/models/example/up.scala:77: type mismatch; [error] found : option[scala.slick.collection.heterogenous.hcons[long,scala.slick.collection.heterogenous.hcons[option[java.sql.timestamp],scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hcons[boolean,scala.slick.collection.heterogenous.hnil.type]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] [error] required: option[scala.slick.collection.heterogenous.syntax.::[long,scala.slick.collection.heterogenous.syntax.::[option[java.sql.timestamp],scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.syntax.::[boolean,scala.slick.collection.heterogenous.hnil.type]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] [error] up.unapply _ [error] ^ [error] 1 error found [error] (compile:compile) compilation failed [error] total time: 20 s, completed 31 oct, 2014 9:20:31 pm

the file in question app/models/example/up.scala shown below:

package models.example import play.api.db.slick.config.driver.simple._ import scala.slick.lifted.tag import scala.slick.collection.heterogenous._ import java.sql.timestamp class up( val id: long, val createddate: option[timestamp], val c2: boolean, val c3: boolean, val c4: boolean, val c5: boolean, val c6: boolean, val c7: boolean, val c8: boolean, val c9: boolean, val c10: boolean, val c11: boolean, val c12: boolean, val c13: boolean, val c14: boolean, val c15: boolean, val c16: boolean, val c17: boolean, val c18: boolean, val c19: boolean, val c20: boolean, val c21: boolean, val c22: boolean, val c23: boolean, val c24: boolean, val c25: boolean, val c26: boolean, val c27: boolean, val c28: boolean, val c29: boolean, val c30: boolean, val c31: boolean, val c32: boolean, val c33: boolean, val c34: boolean, val c35: boolean, val c36: boolean, val c37: boolean, val c38: boolean, val c39: boolean, val c40: boolean, val c41: boolean, val c42: boolean, val c43: boolean, val c44: boolean, val c45: boolean, val c46: boolean) object { def apply( id: long, createddate: option[timestamp], c2: boolean, c3: boolean, c4: boolean, c5: boolean, c6: boolean, c7: boolean, c8: boolean, c9: boolean, c10: boolean, c11: boolean, c12: boolean, c13: boolean, c14: boolean, c15: boolean, c16: boolean, c17: boolean, c18: boolean, c19: boolean, c20: boolean, c21: boolean, c22: boolean, c23: boolean, c24: boolean, c25: boolean, c26: boolean, c27: boolean, c28: boolean, c29: boolean, c30: boolean, c31: boolean, c32: boolean, c33: boolean, c34: boolean, c35: boolean, c36: boolean, c37: boolean, c38: boolean, c39: boolean, c40: boolean, c41: boolean, c42: boolean, c43: boolean, c44: boolean, c45: boolean, c46: boolean ) = new up( id, createddate, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46 ) def unapply(x: up) = { val info = x.id :: x.createddate :: x.c2 :: x.c3 :: x.c4 :: x.c5 :: x.c6 :: x.c7 :: x.c8 :: x.c9 :: x.c10 :: x.c11 :: x.c12 :: x.c13 :: x.c14 :: x.c15 :: x.c16 :: x.c17 :: x.c18 :: x.c19 :: x.c20 :: x.c21 :: x.c22 :: x.c23 :: x.c24 :: x.c25 :: x.c26 :: x.c27 :: x.c28 :: x.c29 :: x.c30 :: x.c31 :: x.c32 :: x.c33 :: x.c34 :: x.c35 :: x.c36 :: x.c37 :: x.c38 :: x.c39 :: x.c40 :: x.c41 :: x.c42 :: x.c43 :: x.c44 :: x.c45 :: x.c46 :: hnil option[data.type](data) } } class ups(tag: tag) extends table[up](tag, "ups") { def * = ( id :: createddate :: c2 :: c3 :: c4 :: c5 :: c6 :: c7 :: c8 :: c9 :: c10 :: c11 :: c12 :: c13 :: c14 :: c15 :: c16 :: c17 :: c18 :: c19 :: c20 :: c21 :: c22 :: c23 :: c24 :: c25 :: c26 :: c27 :: c28 :: c29 :: c30 :: c31 :: c32 :: c33 :: c34 :: c35 :: c36 :: c37 :: c38 :: c39 :: c40 :: c41 :: c42 :: c43 :: c44 :: c45 :: c46 :: hnil).shaped <> ( { case x => up( x(0), x(1), x(2), x(3), x(4), x(5), x(6), x(7), x(8), x(9), x(10), x(11), x(12), x(13), x(14), x(15), x(16), x(17), x(18), x(19), x(20), x(21), x(22), x(23), x(24), x(25), x(26), x(27), x(28), x(29), x(30), x(31), x(32), x(33), x(34), x(35), x(36), x(37), x(38), x(39), x(40), x(41), x(42), x(43), x(44), x(45), x(46) ) }, { up.unapply _ }) def id = column[long]("id", o.primarykey, o.autoinc, o.notnull) def createddate = column[option[timestamp]]("created_date") def c2 = column[boolean]("c2") def c3 = column[boolean]("c3") def c4 = column[boolean]("c4") def c5 = column[boolean]("c5") def c6 = column[boolean]("c6") def c7 = column[boolean]("c7") def c8 = column[boolean]("c8") def c9 = column[boolean]("c9") def c10 = column[boolean]("c10") def c11 = column[boolean]("c11") def c12 = column[boolean]("c12") def c13 = column[boolean]("c13") def c14 = column[boolean]("c14") def c15 = column[boolean]("c15") def c16 = column[boolean]("c16") def c17 = column[boolean]("c17") def c18 = column[boolean]("c18") def c19 = column[boolean]("c19") def c20 = column[boolean]("c20") def c21 = column[boolean]("c21") def c22 = column[boolean]("c22") def c23 = column[boolean]("c23") def c24 = column[boolean]("c24") def c25 = column[boolean]("c25") def c26 = column[boolean]("c26") def c27 = column[boolean]("c27") def c28 = column[boolean]("c28") def c29 = column[boolean]("c29") def c30 = column[boolean]("c30") def c31 = column[boolean]("c31") def c32 = column[boolean]("c32") def c33 = column[boolean]("c33") def c34 = column[boolean]("c34") def c35 = column[boolean]("c35") def c36 = column[boolean]("c36") def c37 = column[boolean]("c37") def c38 = column[boolean]("c38") def c39 = column[boolean]("c39") def c40 = column[boolean]("c40") def c41 = column[boolean]("c41") def c42 = column[boolean]("c42") def c43 = column[boolean]("c43") def c44 = column[boolean]("c44") def c45 = column[boolean]("c45") def c46 = column[boolean]("c46") } object ups { val ups = tablequery[ups] def get(id: long)(implicit session: session): option[up] = {ups.where(_.id === id).firstoption} }

i thought because of bug in scala compiler - https://issues.scala-lang.org/browse/si-8146

so upgraded scala 2.10.4 still receive compilation errors.

contents of build.sbt:

name := "play-sample" version := "0.1-snapshot" scalaversion in thisbuild := "2.10.4" librarydependencies ++= seq( jdbc, anorm, cache, "org.webjars" %% "webjars-play" % "2.2.0", "org.webjars" % "bootstrap" % "3.1.1", "com.nulab-inc" %% "play2-oauth2-provider" % "0.7.1", "com.typesafe.play" %% "play-slick" % "0.6.1", "mysql" % "mysql-connector-java" % "5.1.18", "org.xerial" % "sqlite-jdbc" % "3.7.2" ) play.project.playscalasettings instrumentsettings

what doing wrong?

how can prepare ?

i had similar problem. used hlist in project , realized caused compilation process running in eclipse "colliding" compilation issued sbt.

just seek close eclipse , compile project via sbt , see happens.

i've tried compiling project on scala 2.10.4 , scala 2.11.2 , had no problems. if add together 'build.sbt', 'librarydependencies' may helpful.

scala slick-2.0 play-slick

No comments:

Post a Comment