@@ -2993,6 +2993,9 @@ A type's typeSymbol should never be inspected directly.
2993
2993
2994
2994
/** A creator for intersection type where intersections of a single type are
2995
2995
* replaced by the type itself, and repeated parent classes are merged.
2996
+ *
2997
+ * !!! Repeated parent classes are not merged - is this a bug in the
2998
+ * comment or in the code?
2996
2999
*/
2997
3000
def intersectionType (tps : List [Type ], owner : Symbol ): Type = tps match {
2998
3001
case List (tp) =>
@@ -5749,9 +5752,16 @@ A type's typeSymbol should never be inspected directly.
5749
5752
val lubType =
5750
5753
if (phase.erasedTypes || depth == 0 ) lubBase
5751
5754
else {
5752
- val lubRefined = refinedType(lubParents, lubOwner)
5755
+ val lubRefined = refinedType(lubParents, lubOwner)
5753
5756
val lubThisType = lubRefined.typeSymbol.thisType
5754
- val narrowts = ts map (_.narrow)
5757
+ val narrowts = ts map (_.narrow)
5758
+ def excludeFromLub (sym : Symbol ) = (
5759
+ sym.isClass
5760
+ || sym.isConstructor
5761
+ || ! sym.isPublic
5762
+ || isGetClass(sym)
5763
+ || narrowts.exists(t => ! refines(t, sym))
5764
+ )
5755
5765
def lubsym (proto : Symbol ): Symbol = {
5756
5766
val prototp = lubThisType.memberInfo(proto)
5757
5767
val syms = narrowts map (t =>
@@ -5780,16 +5790,15 @@ A type's typeSymbol should never be inspected directly.
5780
5790
// efficiency.
5781
5791
alt != sym && ! specializesSym(lubThisType, sym, tp, alt)))
5782
5792
}
5783
- for (sym <- lubBase.nonPrivateMembers) {
5784
- // add a refinement symbol for all non-class members of lubBase
5785
- // which are refined by every type in ts.
5786
- if (! sym.isClass && ! sym.isConstructor && ! isGetClass(sym) && (narrowts forall (t => refines(t, sym))))
5787
- try {
5788
- val lsym = lubsym(sym)
5789
- if (lsym != NoSymbol ) addMember(lubThisType, lubRefined, lubsym(sym))
5790
- } catch {
5791
- case ex : NoCommonType =>
5792
- }
5793
+ // add a refinement symbol for all non-class members of lubBase
5794
+ // which are refined by every type in ts.
5795
+ for (sym <- lubBase.nonPrivateMembers ; if ! excludeFromLub(sym)) {
5796
+ try {
5797
+ val lsym = lubsym(sym)
5798
+ if (lsym != NoSymbol ) addMember(lubThisType, lubRefined, lsym)
5799
+ } catch {
5800
+ case ex : NoCommonType =>
5801
+ }
5793
5802
}
5794
5803
if (lubRefined.decls.isEmpty) lubBase
5795
5804
else if (! verifyLubs) lubRefined
0 commit comments