We also need some help for other `SingletonTypes`. `Test4` below fails with:

```
qbin/scalac sandbox/test.scala
sandbox/test.scala:31: error: type mismatch;
 found   : x.type (with underlying type Test4)
 required: Test4.this.type
    case Id(x) => x
                  ^
one error found
```

Unless we apply this patch:

``` git diff
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index ca01a4b..269044d 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -1240,6 +1240,7 @@ trait Types
       if (pre.isOmittablePrefix) pre.fullName + ".type"
       else prefixString + "type"
     }
+    override def finalResultType: Type = this

 /*
     override def typeOfThis: Type = typeSymbol.typeOfThis
@@ -1358,6 +1359,7 @@ trait Types
       toBoolean(trivial)
     }
     override def isGround = sym.isPackageClass || pre.isGround
+    override def finalResultType: Type = if (sym.isModule) super.finalResultType else this

     private[reflect] var underlyingCache: Type = NoType
     private[reflect] var underlyingPeriod = NoPeriod
  ~/code/scala cat sandbox/test.scala
object Test2 {
  // Has never worked, but seems desirable given the recent changes to
  // pattern type inference.
  val a = ""
  object Id {
    def unapply(xxxx: Any): Some[a.type] = Some[a.type](a)
  }
  val b: a.type = (a: a.type) match {
    case Id(x) => x
  }
}


object Test3 {
  val a = ""
  object Id {
    def unapply(xxxx: Any): Some[Test3.type] = Some[Test3.type](Test3)
  }
  val b: Test3.type = a match {
    case Id(x) => x
  }
}


class Test4 {
  val a = ""
  object Id {
    def unapply(xxxx: Any): Some[Test4.this.type] = Some[Test4.this.type](Test4.this)
  }
  val b: Test4.this.type = a match {
    case Id(x) => x
  }
}
```