Skip to content

Commit 87f885b

Browse files
committed
XXX Confirm we actually found a member with right name.
XXX But that's maybe a bad idea, test on mutual recursion (scala#2001)!
1 parent 521f042 commit 87f885b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/TypeErrors.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ class CyclicReference private (val denot: SymDenotation, var inImplicitSearch: B
110110
def errorMsg(cx: Context): Message = {
111111
if (cx.mode is Mode.InferringReturnType) {
112112
cx.tree match {
113-
case tree: untpd.ValOrDefDef if inImplicitSearch && !tree.tpt.typeOpt.exists =>
113+
case tree: untpd.ValOrDefDef if inImplicitSearch && !tree.tpt.typeOpt.exists && tree.name == cycleSym.name =>
114114
// Can happen in implicit defs (#4709) or outside (#3253).
115115
TermMemberNeedsNeedsResultTypeForImplicitSearch(cycleSym)
116-
case tree: untpd.DefDef if !tree.tpt.typeOpt.exists =>
116+
case tree: untpd.DefDef if !tree.tpt.typeOpt.exists && tree.name == cycleSym.name =>
117117
OverloadedOrRecursiveMethodNeedsResultType(tree.name)
118-
case tree: untpd.ValDef if !tree.tpt.typeOpt.exists =>
118+
case tree: untpd.ValDef if !tree.tpt.typeOpt.exists && tree.name == cycleSym.name =>
119119
RecursiveValueNeedsResultType(tree.name)
120120
case _ =>
121121
errorMsg(cx.outer)

0 commit comments

Comments
 (0)