summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-06 17:35:12 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-07 11:21:02 +1000
commitd76a2812ca56cd0d093fbbeb3ab60b35cd9c3180 (patch)
treee7ddc26676a9310c87e112406ba20da7c68817d4 /src/reflect
parentcd50464cd019bc6a489a72b98293c30b91352bab (diff)
downloadscala-d76a2812ca56cd0d093fbbeb3ab60b35cd9c3180.tar.gz
scala-d76a2812ca56cd0d093fbbeb3ab60b35cd9c3180.tar.bz2
scala-d76a2812ca56cd0d093fbbeb3ab60b35cd9c3180.zip
SI-7602 Avoid crash in LUBs with erroneous code
If a class contains a double defintion of a method that overrides an interface method, LUBs could run into a spot where filtering overloaded alternatives to those that match the interface method fails to resolve to a single overload, which crashes the compiler. This commit uses `filter` rather than `suchThat` to avoid the crash.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/tpe/GlbLubs.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/tpe/GlbLubs.scala b/src/reflect/scala/reflect/internal/tpe/GlbLubs.scala
index 876685e24a..123b44aa05 100644
--- a/src/reflect/scala/reflect/internal/tpe/GlbLubs.scala
+++ b/src/reflect/scala/reflect/internal/tpe/GlbLubs.scala
@@ -347,7 +347,9 @@ private[internal] trait GlbLubs {
def lubsym(proto: Symbol): Symbol = {
val prototp = lubThisType.memberInfo(proto)
val syms = narrowts map (t =>
- t.nonPrivateMember(proto.name).suchThat(sym =>
+ // SI-7602 With erroneous code, we could end up with overloaded symbols after filtering
+ // so `suchThat` unsuitable.
+ t.nonPrivateMember(proto.name).filter(sym =>
sym.tpe matches prototp.substThis(lubThisType.typeSymbol, t)))
if (syms contains NoSymbol) NoSymbol