Skip to content

Regression(?) in kubukoz/slick-effect - type projections in separate compilation runs #22581

Open
@jchyb

Description

OpenCB: https://github.com/VirtusLab/community-build3/actions/runs/13209505213/job/36881103468

Compiler version

Working(?): 3.6.3
Broken(?): 3.6.4-RC1

Minimized code

Has to be split into 2 modules/separate compilation runs, for simplicity let's use scala-cli:

main.scala

package slickeffect

object Transactor {
  def fromDatabase(dbF: JdbcBackend#Database): Unit = ???
}

trait JdbcProfile {
  val backend: JdbcBackend = ??? 
}
object H2Profile extends JdbcProfile

trait JdbcBackend {
  type Database = DatabaseFactory
  val Database: DatabaseFactory = ???

  class DatabaseFactory {
    def forURL(url: String): DatabaseFactory = ???
  }
}

main.test.scala

package slickeffect

class TransactorTests {
  Transactor.fromDatabase(H2Profile.backend.Database.forURL("jdbc:h2:mem:"))
}

scala-cli test main.scala main.test.scala

Output

In 3.6.4-RC1 and before - no error.
In 3.7.0-RC1-bin-20250207-d60a914-NIGHTLY:

[error] -- [E007] Type Mismatch Error: /Users/jchyb/workspace/slick-effect/transactor/src/main/scala/slickeffect/Transactor.scala:28:61 
[error] 28 |    Transactor.fromDatabase(H2Profile.backend.Database.forURL("jdbc:h2:mem:"))
[error]    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |                 Found:    slickeffect.H2Profile.backend.DatabaseFactory
[error]    |                 Required: slickeffect.JdbcBackend#Database
[error]    |
[error]    | longer explanation available when compiling with `-explain`

Expectation

Not sure. Type projections like this should be unsupported in scala 3, and this error can also appear in previous compiler versions if both files are a part of the same compilation run. This leads me to believe this is more of a bugfix then regression, but I still wanted to log somewhere the OpenCB error and minimization.

Metadata

Assignees

No one assigned

    Labels

    area:typeritype:bugregressionThis worked in a previous version but doesn't anymorestat:needs bisectionNeed to use nightly builds and git bisect to find out the commit where this issue was introduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions