File tree 3 files changed +29
-3
lines changed
compiler/src/dotty/tools/dotc/transform/patmat 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -584,10 +584,13 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
584
584
// precondition: `tp1` should have the shape `path.Child`, thus `ThisType` is always covariant
585
585
val thisTypeMap = new TypeMap {
586
586
def apply (t : Type ): Type = t match {
587
- case tp @ ThisType (tref) if ! tref.symbol.isStaticOwner && ! tref.symbol.is( Module ) =>
587
+ case tp @ ThisType (tref) if ! tref.symbol.isStaticOwner =>
588
588
// TODO: stackoverflow here
589
589
// newTypeVar(TypeBounds.upper(mapOver(tp.underlying)))
590
- newTypeVar(TypeBounds .upper(mapOver(tref & tref.classSymbol.asClass.givenSelfType)))
590
+ if (tref.symbol.is(Module ))
591
+ ThisType .raw(mapOver(tref).asInstanceOf [TypeRef ])
592
+ else
593
+ newTypeVar(TypeBounds .upper(mapOver(tref & tref.classSymbol.asClass.givenSelfType)))
591
594
case _ =>
592
595
mapOver(t)
593
596
}
@@ -633,7 +636,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
633
636
else {
634
637
val protoTp2 = typeParamMap(tp2)
635
638
if (protoTp1 <:< protoTp2) {
636
- isFullyDefined(protoTp1 & protoTp2, force)
639
+ isFullyDefined(AndType ( protoTp1, protoTp2) , force)
637
640
instUndetMap(protoTp1)
638
641
}
639
642
else {
Original file line number Diff line number Diff line change
1
+ trait AxisCompanion {
2
+ sealed trait Format
3
+ object Format {
4
+ case object Decimal extends Format
5
+ case object Integer extends Format
6
+ }
7
+ }
8
+ object Axis extends AxisCompanion
9
+ class Axis {
10
+ import Axis ._
11
+ def test ( f : Format ) = f match {
12
+ case Format .Integer => " Int"
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ object O {
2
+ sealed trait Trait [+ A ] { type T }
3
+ case class CaseClass [+ A ](a : A ) extends Trait [A ] { type T = Nothing }
4
+
5
+ def id [TT , A ](v : Trait [A ] { type T = TT }): Trait [A ] { type T = TT } =
6
+ v match {
7
+ case CaseClass (a) => CaseClass (a)
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments