diff options
author | Paul Phillips <paulp@improving.org> | 2014-01-09 14:27:24 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2014-01-09 14:30:20 -0800 |
commit | 10f58e9d6aec2026772129dc540b95defe267025 (patch) | |
tree | 2dd080e4e23ca8ee920834e40e77c7a309e8e7f7 | |
parent | 9dae7420cf8cbc6a0fb2fddee93f87563da0d83d (diff) | |
download | scala-10f58e9d6aec2026772129dc540b95defe267025.tar.gz scala-10f58e9d6aec2026772129dc540b95defe267025.tar.bz2 scala-10f58e9d6aec2026772129dc540b95defe267025.zip |
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.
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 3ccf321227..2271232e90 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -847,7 +847,9 @@ trait Definitions extends api.StandardDefinitions { case m if m.paramss.nonEmpty => Nil case m => m :: loop(n + 1) } - loop(1) + // Since ErrorType always returns a symbol from a call to member, we + // had better not start looking for _1, _2, etc. expecting it to run out. + if (tpe.isErroneous) Nil else loop(1) } /** If `tp` has a term member `name`, the first parameter list of which |