Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve recursive decompose prefix fix #19375

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -619,7 +619,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(JavaEnum) => 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
Loading