diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-11-06 17:35:12 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-11-07 11:21:02 +1000 |
commit | d76a2812ca56cd0d093fbbeb3ab60b35cd9c3180 (patch) | |
tree | e7ddc26676a9310c87e112406ba20da7c68817d4 /src | |
parent | cd50464cd019bc6a489a72b98293c30b91352bab (diff) | |
download | scala-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')
-rw-r--r-- | src/reflect/scala/reflect/internal/tpe/GlbLubs.scala | 4 |
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 |