Skip to content

Commit

Permalink
Fix regression in exhausitivity of HK types
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jul 27, 2023
1 parent dde69ce commit 30731c1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ object SpaceEngine {
case pat: Ident if isBackquoted(pat) =>
Typ(pat.tpe, decomposed = false)

case pat: Ident if pat.name == nme.WILDCARD =>
Typ(erase(pat.tpe.stripAnnots.widenSkolem), decomposed = false)

case Ident(_) | Select(_, _) =>
Typ(erase(pat.tpe.stripAnnots.widenSkolem, isValue = true), decomposed = false)

Expand Down
15 changes: 15 additions & 0 deletions tests/pos/i17230.min1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// scalac: -Werror
trait Foo:
type Bar[_]

object Foo:
type Aux[B[_]] = Foo { type Bar[A] = B[A] }

class Test:
def t1[B[_]](self: Option[Foo.Aux[B]]) = self match
case Some(_) => 1
case None => 2

def t2[B[_]](self: Option[Foo.Aux[B]]) = self match
case Some(f) => 1
case None => 2
20 changes: 20 additions & 0 deletions tests/pos/i17230.orig.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// scalac: -Werror
import scala.util.*

trait Transaction {
type State[_]
}
object Transaction {
type of[S[_]] = Transaction { type State[A] = S[A] }
}
trait DynamicScope[State[_]]

case class ScopeSearch[State[_]](self: Either[Transaction.of[State], DynamicScope[State]]) {

def embedTransaction[T](f: Transaction.of[State] => T): T =
self match {
case Left(integrated) => ???
case Right(ds) => ???
}
}

0 comments on commit 30731c1

Please sign in to comment.