Skip to content

Commit

Permalink
Extra help for -Vcyclic
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Apr 9, 2024
1 parent aa0faec commit b8901c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -852,9 +852,11 @@ trait TypeDiagnostics extends splain.SplainDiagnostics {
else if (organics.length == 1) organics(0)
else organics.find(_.pos.focus == pos.focus).getOrElse(organics(0))
}
def help = if (!badsym.isSynthetic || settings.cyclic.value) "" else
s"; $badsym is synthetic; use -Vcyclic to find which definition needs an explicit type"
condOpt(tree) {
case ValDef(_, _, TypeTree(), _) => s"recursive $badsym needs type"
case DefDef(_, _, _, _, TypeTree(), _) => s"${cyclicAdjective(badsym)} $badsym needs result type"
case ValDef(_, _, TypeTree(), _) => s"recursive $badsym needs type$help"
case DefDef(_, _, _, _, TypeTree(), _) => s"${cyclicAdjective(badsym)} $badsym needs result type$help"
case Import(_, _) =>
sm"""encountered unrecoverable cycle resolving import.
|Note: this is often due in part to a class depending on a definition nested within its companion.
Expand Down
2 changes: 1 addition & 1 deletion test/files/neg/t7808b.check
@@ -1,4 +1,4 @@
t7808b.scala:5: error: recursive value x$1 needs type
t7808b.scala:5: error: recursive value x$1 needs type; value x$1 is synthetic; use -Vcyclic to find which definition needs an explicit type
val (ls, rs) = z match {
^
1 error

0 comments on commit b8901c0

Please sign in to comment.