Skip to content

dotty-doc-bootstrapped can't be compiled with -Ycheck:all #4295

Closed
@gsps

Description

@gsps

In the current build dotty-doc is not compiled with any -Ychecks, but if ones does, e.g., by adding scalacOptions ++= "-Ycheck:all" to dottyDocSettings in Build.scala, then the bootstrapped compiler fails as follows:

[error] (dotty-doc-bootstrapped/compile:compileIncremental) java.lang.AssertionError: assertion failed: Types differ
[error] Original type : Map[String, Nothing]
[error] After checking: Map[String, Any]
[error] Original tree : Map.empty[String, Any]
[error] After checking: Map.empty[String, Any]
[error] Why different :
[error]              Subtype trace:
[error]   ==> Map[String, Any] <:< Map[String, Nothing]
[error]     ==> compareAppliedType2 Map[String, Any], Map[String, Nothing]
[error]       ==> scala.collection.immutable.type(scala.collection.immutable) <:< scala.collection.immutable.type(scala.collection.immutable)
[error]       <== scala.collection.immutable.type(scala.collection.immutable) <:< scala.collection.immutable.type(scala.collection.immutable) = true
[error]       ==> String <:< String
[error]         ==> String <:< String
[error]         <== String <:< String = true
[error]       <== String <:< String = true
[error]       ==> String <:< String
[error]         ==> String <:< String
[error]           ==> String <:< String
[error]             ==> String <:< String
[error]             <== String <:< String = true
[error]           <== String <:< String = true
[error]         <== String <:< String = true
[error]       <== String <:< String = true
[error]       ==> Any <:< Nothing
[error]         ==> Any <:< Nothing
[error]         <== Any <:< Nothing = false
[error]       <== Any <:< Nothing = false
[error]       ==> compareAppliedType1 Map[String, Any], Map[String, Nothing]
[error]       <== compareAppliedType1 Map[String, Any], Map[String, Nothing] = false
[error]     <== compareAppliedType2 Map[String, Any], Map[String, Nothing] = false
[error]   <== Map[String, Any] <:< Map[String, Nothing] = false

The culprit here is the Map.empty in

implicit class OptMap(val opt: Option[JMap[String, _]]) extends AnyVal {
  def asJava = opt.getOrElse(Map.empty.asJava)
}

found in JavaConverters.scala.

One can work around the problem by adding a type parameter to OptMap[V] and instantiating the types in Map.empty[String, V] explicitly, but I suppose the Checker should be adapted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions