From 673263028aad932ad8eeb5fd3820177c7574563e Mon Sep 17 00:00:00 2001 From: Eugene Flesselle Date: Wed, 6 Aug 2025 17:34:54 +0200 Subject: [PATCH] Fix implicit scope liftToAnchors for parameter lower bounds Related to https://github.com/scala/scala3/pull/23672#event-19012454596 But we were dropping a lower bound in this case. --- compiler/src/dotty/tools/dotc/typer/Implicits.scala | 2 +- tests/pos/i21951b.scala | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i21951b.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index fa5b1cbfe19e..b330e68ae5c5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -832,7 +832,7 @@ trait ImplicitRunInfo: WildcardType else seen += t - t.superType match + t.underlying match case TypeBounds(lo, hi) => if lo.isBottomTypeAfterErasure then apply(hi) else AndType.make(apply(lo), apply(hi)) diff --git a/tests/pos/i21951b.scala b/tests/pos/i21951b.scala new file mode 100644 index 000000000000..30068b89d994 --- /dev/null +++ b/tests/pos/i21951b.scala @@ -0,0 +1,12 @@ + +class A +object A: + given A = ??? + +class B[X] +object B: + given g[T]: B[T] = ??? + +object Test: + def foo[X >: A] = summon[X] // was error + def bar[F[T] >: B[T]] = summon[F[Int]] // was error