Skip to content

Commit 10f58e9

Browse files
committed
Fix infinite recursion in name-based patmat.
I discovered on erroneous code it could fall into a loop looking for product selectors, because ErrorType always claims to have whatever member you're asking about.
1 parent 9dae742 commit 10f58e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/reflect/scala/reflect/internal/Definitions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,9 @@ trait Definitions extends api.StandardDefinitions {
847847
case m if m.paramss.nonEmpty => Nil
848848
case m => m :: loop(n + 1)
849849
}
850-
loop(1)
850+
// Since ErrorType always returns a symbol from a call to member, we
851+
// had better not start looking for _1, _2, etc. expecting it to run out.
852+
if (tpe.isErroneous) Nil else loop(1)
851853
}
852854

853855
/** If `tp` has a term member `name`, the first parameter list of which

0 commit comments

Comments
 (0)