Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gsps opened this issue Apr 11, 2018 · 3 comments
Closed

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

gsps opened this issue Apr 11, 2018 · 3 comments

Comments

@gsps
Copy link
Contributor

gsps commented Apr 11, 2018

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.

@smarter
Copy link
Member

smarter commented Apr 11, 2018

Could you make a minimal example reproducing the problem? Also can you check if it happens on top of #4183 ?

gsps added a commit to gsps/dotty that referenced this issue Apr 11, 2018
@gsps
Copy link
Contributor Author

gsps commented Apr 19, 2018

Given that #4183 has been merged, I'll try again once I've rebased my branch on top of master.

gsps added a commit to gsps/dotty that referenced this issue Apr 20, 2018
gsps added a commit to gsps/dotty that referenced this issue Apr 21, 2018
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Feb 6, 2019
@OlivierBlanvillain
Copy link
Contributor

Seams to be fixed on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants