Skip to content

Commit

Permalink
Back off failing refineUsingParent
Browse files Browse the repository at this point in the history
Turns out to be too strict.
  • Loading branch information
dwijnand committed Dec 12, 2023
1 parent 0c26ce1 commit 6fd207f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/dotc/core/TypeOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,8 @@ object TypeOps:
}

def instantiate(): Type = {
var failedMixin = false
for tp <- mixins.reverseIterator do
failedMixin ||= !(protoTp1 <:< tp)
if failedMixin then return NoType
protoTp1 <:< tp
maximizeType(protoTp1, NoSpan)
wildApprox(protoTp1)
}
Expand Down
4 changes: 4 additions & 0 deletions tests/pos/i19031.ci-reg1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ class Test:
def t1(foo: Foo[Int]): Unit = foo match
case _: Mark[t] =>
case _ =>

def t2[F <: Foo[Int]](foo: F): Unit = foo match
case _: Mark[t] =>
case _ =>
2 changes: 2 additions & 0 deletions tests/pos/i19031.ci-reg2.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//> using options -Werror

trait Outer:
sealed trait Foo
case class Bar1() extends Foo
Expand Down

0 comments on commit 6fd207f

Please sign in to comment.