Skip to content

scala.MatchError: LazyRef(...) (of class dotty.tools.dotc.core.Types$LazyRef) #12327

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
xuwei-k opened this issue May 4, 2021 · 3 comments · Fixed by #12553
Closed

scala.MatchError: LazyRef(...) (of class dotty.tools.dotc.core.Types$LazyRef) #12327

xuwei-k opened this issue May 4, 2021 · 3 comments · Fixed by #12553

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented May 4, 2021

Compiler version

  • 3.0.0-RC3
  • 3.0.1-RC1-bin-20210503-98ecc10-NIGHTLY

Minimized code

build.sbt

scalaVersion := "3.0.0-RC3"

project/build.properties

sbt.version=1.5.1

Foo.scala

package example

trait Foo[A]

object Foo {
  implicit def javaEnumInstance[A <: java.lang.Enum[A]]: Foo[A] =
    ???
}

Output

run sbt doc

[warn] -- Warning: Foo.scala:6:15 -----------------------------------------------------
[warn] 6 |  implicit def javaEnumInstance[A <: java.lang.Enum[A]]: Foo[A] =
[warn]   |  ^
[warn]   |scala.MatchError: LazyRef(...) (of class dotty.tools.dotc.core.Types$LazyRef)
[warn]   |	at dotty.tools.scaladoc.tasty.TypesSupport.dotty$tools$scaladoc$tasty$TypesSupport$$inner(TypesSupport.scala:262)
[warn]   |	at dotty.tools.scaladoc.tasty.TypesSupport.inner$$anonfun$5(TypesSupport.scala:190)
[warn]   |	at scala.collection.immutable.List.map(List.scala:246)
[warn]   |	at dotty.tools.scaladoc.tasty.TypesSupport.dotty$tools$scaladoc$tasty$TypesSupport$$inner(TypesSupport.scala:190)
[warn] 7 |    ???
[warn] two warnings found
[info] Main Scala API documentation successful.

Expectation

@smarter
Copy link
Member

smarter commented May 4, 2021

https://github.com/lampepfl/dotty/blob/d81b0e502dd29e24d8594d48da3f405d4ea75c51/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala#L84 attempts to exhaustively match on all possibly types, but there's no extractor for LazyRef in tasty-reflect.
@romanowski What is this code used for?
@nicolasstucki is there a good way to handle all types? In the compiler a common pattern is to match on TypeProxy and recurse on .underlying but I don't see a TypeProxy in tasty-reflect.

@odersky
Copy link
Contributor

odersky commented May 5, 2021

Maybe the type extractors could skip a LazyRef? But then we would have no natural recursion brake anymore.

@pikinier20
Copy link
Contributor

https://github.com/lampepfl/dotty/blob/d81b0e502dd29e24d8594d48da3f405d4ea75c51/scaladoc/src/dotty/tools/scaladoc/tasty/TypesSupport.scala#L84

attempts to exhaustively match on all possibly types, but there's no extractor for LazyRef in tasty-reflect.
@romanowski What is this code used for?
@nicolasstucki is there a good way to handle all types? In the compiler a common pattern is to match on TypeProxy and recurse on .underlying but I don't see a TypeProxy in tasty-reflect.

The code you attached is meant to construct showable representation of type (strings and links). LazyRefs probably need to be handled there to avoid MatchErrors.

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

Successfully merging a pull request may close this issue.

6 participants