Skip to content

type error on separate compilation (pickler foiled by path dependent parent type in the presence of overloading) #7596

@scabug

Description

@scabug

scalac shows a type error when dao.scala is compiled separately from tables.scala, but not when both are compiled together. The Slick-Play sample app is affected by this.

Also see same bug at sbt issue tracker sbt/sbt#786 .

reproduce code

// tables.scala
trait H2Driver{
    abstract class Table[T]
}

object Config {
  val driver : H2Driver = null
  def driver(app: Any): H2Driver = null
}

class Sites extends Config.driver.Table[String]
// dao.scala
class DAOBase[E]{
  type TableType <: Config.driver.Table[E]
}
class SitesDAO extends DAOBase[String]{
  type TableType = Sites
}

expected

$ scalac -cp . dao.scala tables.scala 
$ scalac -cp . dao.scala
$

actual

$ scalac . dao.scala tables.scala 
$ scalac . dao.scala

dao.scala:5: error: overriding type TableType in class DAOBase with bounds <: Config.driver.Table[String];
 type TableType has incompatible type
  type TableType = Sites
       ^
one error found
$

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions