Skip to content

improve diagnostic error for diverging implicit expansion #8454

Open
@scabug

Description

@scabug

WIP: https://github.com/retronym/scala/compare/topic;diverging-explain?expand=1

example:

-starting with method tc in class CompilerHang
+starting with method tc in class CompilerHang.
+ CompilerHang.this.breakage[F]
+   CompilerHang.this.tc[M]
+     CompilerHang.this.tc[M]
[error] /Users/jason/code/shapeless/examples/src/main/scala/shapeless/examples/ordering.scala:58: diverging implicit expansion for type Ordering[shapeless.examples.OrderingExamples.Foo]
[error] starting with method hlistIsoOrdering in object OrderingExamples.
[error]  scala.this.Predef.implicitly[Ordering[shapeless.examples.OrderingExamples.Foo]]
[error]    math.this.Ordering.comparatorToOrdering[shapeless.examples.OrderingExamples.Foo]
[error]      examples.this.OrderingExamples.hlistIsoOrdering[shapeless.examples.OrderingExamples.Foo, H]
[error]        math.this.Ordering.comparatorToOrdering[shapeless.::[Int,shapeless.::[String,shapeless.HNil]]]

We could also display the corresponding complexity scores calculated in dominates.

https://twitter.com/dlwh/status/412474285806993408

diverging implicit expansions are the most infuriating error messages in the scala compiler

http://stackoverflow.com/questions/20566469/log-implicits-only-for-diverging-implicit-expansions

Other answers suggest using "-Xlog-implicits" option for debugging "diverging implicit expansion" errors. However, it also logs a lot of implicits in places unrelated to these errors. Is there some way to limit it to only explain places which produce compilation errors?

https://twitter.com/mapastr/status/449209695149236224

That moment in which _.some compiles and Some(_) in the same place doesn't with diverging implicit expansion error WTF #scala #scalaz

https://twitter.com/mnnakamura/status/434538504282861568

any idea how to get the scala compiler to stop diverging on my implicit chains?  asking for a friend. https://gist.github.com/mosesn/9014381 

https://twitter.com/nlehuen/status/237494434634297345

Gotta love Scala w/ messages like "diverging implicit expansion for type anorm.Column[B] starting with method rowToOption in object Column"

http://stackoverflow.com/questions/7950014/whats-a-diverging-implicit-expansion-scalac-message-mean

What's a “diverging implicit expansion” scalac message mean?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions