@@ -363,7 +363,7 @@ object GenericSignatures {
363
363
* e.g. with "tagged types" like Array[Int] with T.
364
364
*/
365
365
private def unboundedGenericArrayLevel (tp : Type )(implicit ctx : Context ): Int = tp match {
366
- case GenericArray (level, core ) if ! (core <:< defn.AnyRefType ) =>
366
+ case GenericArray (core, level ) if ! (core <:< defn.AnyRefType ) =>
367
367
level
368
368
case AndType (tp1, tp2) =>
369
369
unboundedGenericArrayLevel(tp1) max unboundedGenericArrayLevel(tp2)
@@ -426,8 +426,7 @@ object GenericSignatures {
426
426
* In short, members of an existential type (e.g. `T` in `forSome { type T }`) can have pretty arbitrary
427
427
* owners (e.g. when computing lubs, <root> is used). All packageClass symbols have `isJavaDefined == true`.
428
428
*/
429
- case _ : TypeRef =>
430
- val sym = tp.typeSymbol
429
+ case RefOrAppliedType (sym, tp, _) =>
431
430
if (sym.isAbstractType && (! sym.owner.is(JavaDefined ) || sym.is(Scala2Existential )))
432
431
tp
433
432
else
@@ -436,13 +435,6 @@ object GenericSignatures {
436
435
case bounds : TypeBounds =>
437
436
bounds
438
437
439
- case AppliedType (tp, _) =>
440
- val sym = tp.typeSymbol
441
- if (sym.isAbstractType && (! sym.owner.is(JavaDefined ) || sym.is(Scala2Existential )))
442
- tp
443
- else
444
- NoType
445
-
446
438
case _ =>
447
439
NoType
448
440
}
@@ -451,18 +443,16 @@ object GenericSignatures {
451
443
* then Some((N, T)) where N is the number of Array constructors enclosing `T`,
452
444
* otherwise None. Existentials on any level are ignored.
453
445
*/
454
- def unapply (tp : Type )(implicit ctx : Context ): Option [(Int , Type )] = tp.widenDealias match {
455
- case AppliedType (tp, arg :: Nil ) =>
456
- val test = tp.typeSymbol == defn.ArrayClass
457
- if (! test) return None
446
+ def unapply (tp : Type )(implicit ctx : Context ): Option [(Type , Int )] = tp.widenDealias match {
447
+ case defn.ArrayOf (arg) =>
458
448
genericCore(arg) match {
459
449
case NoType =>
460
- unapply( arg) match {
461
- case Some ((level, core)) => Some ((level + 1 , core ))
462
- case None => None
450
+ arg match {
451
+ case GenericArray (core, level) => Some ((core, level + 1 ))
452
+ case _ => None
463
453
}
464
454
case core =>
465
- Some ((1 , core ))
455
+ Some ((core, 1 ))
466
456
}
467
457
case _ =>
468
458
None
0 commit comments