Skip to content
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

scaladoc reports type error where scalac succeeds #7905

Closed
scabug opened this issue Oct 11, 2013 · 3 comments
Closed

scaladoc reports type error where scalac succeeds #7905

scabug opened this issue Oct 11, 2013 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Oct 11, 2013

The issue came up in this StackOverflow question. The code posted there produces an error when running scaladoc, while it compiles fine with scalac.

[error]  found   : SigmaDDFactoryImpl.ipfFactory.inductiveIPFFactory.InductiveTypeImpl
[error]  required: SigmaDDFactoryImpl.ipfFactory.inductiveIPFFactory.InductiveTypeImpl

I reproduced this problem myself, simplifying the code further to:

object A {
  val foo = new B {
    val bar = new C {
      val baz: A.this.type = A.this
    }
  }
}

trait B {
  type E = bar.D

  val bar: C
}

trait C {
  trait D
}

trait G {
  type F = A.foo.E

  def m(f: F) = f match {
    case _: A.foo.bar.D => // error here
  }
}

The produce I have the following:

  • src/main/scala/Test.scala – the above code
  • build.sbt – only contains scalaVersion := "2.10.3"
  • project/build.properties – only contains sbt.version=0.13.0

The following then succeeds: sbt compile. The following fails: sbt doc. The error is slightly different than in the StackOverflow post, but at the same position:

[error] /Users/hhrutz/Desktop/foo/src/main/scala/Test.scala:23: pattern type is incompatible with expected type;
[error]  found   : A.foo.bar.D
[error]  required: A.foo.bar.D
[error]     case _: A.foo.bar.D => // error here
[error]                       ^
@scabug
Copy link
Author

scabug commented Oct 11, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7905?orig=1
Reporter: @Sciss
Affected Versions: 2.10.3

@scabug
Copy link
Author

scabug commented Jul 27, 2014

@kzys said:
Seems the issue itself is fixed already but I'd like to have a test for.

scala/scala#3900

@scabug
Copy link
Author

scabug commented Jul 31, 2014

@som-snytt said:
A couple of anomalies:

apm@mara:~/projects/snytt$ ~/scala-2.10.4/bin/scaladoc -d /tmp foo.scala
warning: dropping dependency on node with no phase object: pickler
foo.scala:24: error: pattern type is incompatible with expected type;
 found   : A.foo.bar.D
 required: A.foo.bar.D
      case _: A.foo.bar.D => // error here
                        ^
model contains 6 documentable templates
one error found
apm@mara:~/projects/snytt$ ~/scala-2.10.4/bin/scaladoc -Xfatal-warnings -d /tmp foo.scala
error: dropping dependency on node with no phase object: pickler
foo.scala:24: error: pattern type is incompatible with expected type;
 found   : A.foo.bar.D
 required: A.foo.bar.D
      case _: A.foo.bar.D => // error here
                        ^
model contains 6 documentable templates
one error found
apm@mara:~/projects/snytt$ ~/scala-2.10.4/bin/scaladoc -Xgenerate-phase-graph g -d /tmp foo.scala
Exception in thread "main" java.util.NoSuchElementException: None.get
	at scala.None$.get(Option.scala:313)
	at scala.None$.get(Option.scala:311)
	at scala.tools.nsc.PhaseAssembly$$anonfun$graphToDotFile$1.apply(PhaseAssembly.scala:291)
	at scala.tools.nsc.PhaseAssembly$$anonfun$graphToDotFile$1.apply(PhaseAssembly.scala:289)
	at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
	at scala.tools.nsc.PhaseAssembly$class.graphToDotFile(PhaseAssembly.scala:289)
	at scala.tools.nsc.PhaseAssembly$class.buildCompilerFromPhasesSet(PhaseAssembly.scala:213)
	at scala.tools.nsc.Global.buildCompilerFromPhasesSet(Global.scala:37)
	at scala.tools.nsc.Global.computePhaseDescriptors(Global.scala:774)
	at scala.tools.nsc.Global.phaseDescriptors$lzycompute(Global.scala:778)
	at scala.tools.nsc.Global.phaseDescriptors(Global.scala:778)
	at scala.tools.nsc.Global$Run.<init>(Global.scala:1301)
	at scala.tools.nsc.doc.DocFactory.makeUniverse(DocFactory.scala:54)
	at scala.tools.nsc.doc.DocFactory.generate$1(DocFactory.scala:122)
	at scala.tools.nsc.doc.DocFactory.document(DocFactory.scala:134)
	at scala.tools.nsc.ScalaDoc.process(ScalaDoc.scala:49)
	at scala.tools.nsc.ScalaDoc$.main(ScalaDoc.scala:75)
	at scala.tools.nsc.ScalaDoc.main(ScalaDoc.scala)
apm@mara:~/projects/snytt$ ~/scala-2.10.4/bin/scaladoc -Xshow-phases
warning: Phases are restricted when using Scaladoc

So it's impossible to inspect the phases.

-Xfatal-warnings doesn't "count" the phase warning because of the compiler error.

Anyway, phase assembly is addressed by #8755.

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

No branches or pull requests

2 participants