add support scala 2.13

17 views
Skip to first unread message

Евгений Афанасьев

unread,
Jan 16, 2021, 12:31:26 PM1/16/21
to ScalikeJDBC Users Group
I have query:
DB readOnly { implicit session =>
withSQL {
select
.from(Post as p)
.join(Vote as v)
.on(p.postId, v.postId)
.orderBy(p.time)
}.one(Post(p.resultName)).toMany(Vote.opt(v)).map{
(p,v:Seq[Vote])=> p.copy(votes = v)
}.list.apply

when I use scala 2.13.4 I have problem with types:

type mismatch;
 found   : (ru.afanasev.jdbc.PostDao.Post, Seq[ru.afanasev.jdbc.PostDao.Vote]) => ru.afanasev.jdbc.PostDao.Post
 required: (ru.afanasev.jdbc.PostDao.Post, scala.collection.Seq[ru.afanasev.jdbc.PostDao.Vote]) => ?
        (p:Post,v:Seq[Vote])=> p.copy(votes = v)

But Seq and Seq is  the same thing :) And with scala 2.12.13 I dont have this problem
Also, I saw trouble with IDEA hightlight with method 'one()' because IDEA tell me that this method requires Nothing WTF ???

Евгений Афанасьев

unread,
Jan 16, 2021, 12:33:39 PM1/16/21
to ScalikeJDBC Users Group
scala
@migration("scala.Seq is now scala.collection.immutable.Seq instead of scala.collection.Seq", "2.13.0")
type Seq[+A] = Seq[A]

@From docs

суббота, 16 января 2021 г. в 20:31:26 UTC+3, Евгений Афанасьев:
Reply all
Reply to author
Forward
0 new messages