I’m using Slick for database access in a project and stumbled upon a strange type check error, that only happens when I inline a variable. I can reproduce it with the “Hello Slick” example project:
val mySuppliers = Seq( /* ... some entries ... */ ) // works fine val upserts = mySuplliers.map(suppliers.insertOrUpdate) val query = DBIO.seq( coffees += ("Colombian", 101, 7.99, 0, 0), DBIO.sequence(upserts) ) // fails with // inferred type arguments [Nothing,Any,slick.dbio.Effect] do not conform // to method sequence's type parameter bounds [R,M[+_] <: TraversableOnce[_],E <: slick.dbio.Effect] val query = DBIO.seq( coffees += ("Colombian", 101, 7.99, 0, 0), DBIO.sequence(mySuplliers.map(suppliers.insertOrUpdate)) )
If my understanding is correct, these two should be equivalent? I’d understand the need for the extra variable, if it had a type annotation, but here I don’t seem to be doing anything that helps inferring the type…
Also, the error does not occur, if I remove the
coffees line in the
How do you know, when a separate variable is needed?