Skip to content

Commit

Permalink
Backport "Improve recursive decompose prefix fix" to LTS (#20818)
Browse files Browse the repository at this point in the history
Backports #19375 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur authored Jun 28, 2024
2 parents 8095737 + 90533c3 commit de5fd77
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ object SpaceEngine {
case OrType(tp1, tp2) => List(tp1, tp2)
case tp if tp.isRef(defn.BooleanClass) => List(ConstantType(Constant(true)), ConstantType(Constant(false)))
case tp if tp.isRef(defn.UnitClass) => ConstantType(Constant(())) :: Nil
case tp @ NamedType(Parts(parts), _) => parts.map(tp.derivedSelect)
case tp @ NamedType(Parts(parts), _) => if parts.exists(_ eq tp) then ListOfNoType else parts.map(tp.derivedSelect)
case _: SingletonType => ListOfNoType
case tp if tp.classSymbol.isAllOf(JavaEnumTrait) => tp.classSymbol.children.map(_.termRef)
// the class of a java enum value is the enum class, so this must follow SingletonType to not loop infinitely
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -Werror

sealed trait Mark[T]

trait Foo[T]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -Werror

trait Outer:
sealed trait Foo
case class Bar1() extends Foo
Expand Down
2 changes: 0 additions & 2 deletions tests/pos/i19031.scala → tests/warn/i19031.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -Werror

sealed trait A:
class B extends A

Expand Down
10 changes: 10 additions & 0 deletions tests/warn/i19031b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sealed trait A:
class B extends A

class C extends A

class Test:
def t1(a: A): Boolean =
a match
case b: A#B => true
case c: C => true

0 comments on commit de5fd77

Please sign in to comment.