@@ -120,16 +120,23 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
120
120
// Compute the erasure of the intersection type with given `parents` according to new spec.
121
121
private def intersectionErasure (parents : List [Type ]): Type =
122
122
if (parents.isEmpty) erasedTypeRef(ObjectClass )
123
- else {
124
- // implement new spec for erasure of refined types.
123
+ else apply {
125
124
val psyms = parents map (_.typeSymbol)
126
- def isUnshadowed (psym : Symbol ) =
127
- ! (psyms exists (qsym => (psym ne qsym) && (qsym isNonBottomSubClass psym)))
128
- val cs = parents.iterator.filter { p => // isUnshadowed is a bit expensive, so try classes first
129
- val psym = p.typeSymbol
130
- psym.isClass && ! psym.isTrait && isUnshadowed(psym)
125
+ if (psyms contains ArrayClass ) {
126
+ // treat arrays specially
127
+ arrayType(
128
+ intersectionErasure(
129
+ parents filter (_.typeSymbol == ArrayClass ) map (_.typeArgs.head)))
130
+ } else {
131
+ // implement new spec for erasure of refined types.
132
+ def isUnshadowed (psym : Symbol ) =
133
+ ! (psyms exists (qsym => (psym ne qsym) && (qsym isNonBottomSubClass psym)))
134
+ val cs = parents.iterator.filter { p => // isUnshadowed is a bit expensive, so try classes first
135
+ val psym = p.typeSymbol
136
+ psym.isClass && ! psym.isTrait && isUnshadowed(psym)
137
+ }
138
+ (if (cs.hasNext) cs else parents.iterator.filter(p => isUnshadowed(p.typeSymbol))).next()
131
139
}
132
- apply((if (cs.hasNext) cs else parents.iterator.filter(p => isUnshadowed(p.typeSymbol))).next())
133
140
}
134
141
135
142
def apply (tp : Type ): Type = {
0 commit comments