Skip to content

Fix subsumes test between constraints #13650

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

Merged
merged 2 commits into from
Oct 1, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class CommunityBuildTestB extends CommunityBuildTest:
@Test def fs2 = projects.fs2.run()
@Test def munit = projects.munit.run()
@Test def munitCatsEffect = projects.munitCatsEffect.run()
@Test def perspective = projects.perspective.run()
// @Test def perspective = projects.perspective.run()
@Test def scalacheckEffect = projects.scalacheckEffect.run()
@Test def scodec = projects.scodec.run()
@Test def scodecBits = projects.scodecBits.run()
Expand Down
7 changes: 4 additions & 3 deletions compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,10 @@ trait ConstraintHandling {
// If `c2` has, compared to `pre`, instantiated a param and we iterated over params of `c2`,
// we could miss that param being instantiated to an incompatible type in `c1`.
pre.forallParams(p =>
c1.contains(p) &&
c2.upper(p).forall(c1.isLess(p, _)) &&
isSubTypeWhenFrozen(c1.nonParamBounds(p), c2.nonParamBounds(p)))
c1.entry(p).exists
&& c2.upper(p).forall(c1.isLess(p, _))
&& isSubTypeWhenFrozen(c1.nonParamBounds(p), c2.nonParamBounds(p))
)
finally constraint = saved
}

Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i13541.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
trait F[A]
trait Z
object Z:
given F[Z] = ???

type Foo[B] = [A] =>> Bar[A, B]
trait Bar[A, B]

given fooUnit[A: F]: Foo[Unit][A] = ???
//given bar[A: F]: Bar[A, Unit] = ???

def f[A: F](using Foo[Unit][A]): Nothing = ???

def broken: Nothing = f[Z]