Skip to content

Commit bee6ff7

Browse files
committed
Relaxed constraint on lower bound and added tests
1 parent 7387da3 commit bee6ff7

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ object Contexts {
930930
// - we don't want TypeComparer constraining these TypeVars
931931
val poly = PolyType(DepParamName.fresh(sym.name.toTypeName) :: Nil)(
932932
pt => (sym.info match {
933-
case tb @ TypeBounds(lo, hi) if (lo eq defn.NothingType) && hi.isLambdaSub => tb
933+
case tb @ TypeBounds(_, hi) if hi.isLambdaSub => tb
934934
case _ => TypeBounds.empty
935935
}) :: Nil,
936936
pt => defn.AnyType)

tests/pos/i6014.scala

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,37 @@ object Test2 {
2121
}
2222

2323
implicit val li: List[Int] = List(1, 2, 3)
24-
bar[Foo[List]]
24+
val lii = bar[Foo[List]]
25+
}
26+
27+
object Test3 {
28+
inline def summon[T] = implicit match {
29+
case t: T => t
30+
}
31+
32+
type K1Top = [t] => Any
33+
34+
class Foo[F <: K1Top]
35+
36+
inline def bar[T] = inline erasedValue[T] match {
37+
case _: Foo[f] => summon[f[Int]]
38+
}
39+
40+
implicit val li: List[Int] = List(1, 2, 3)
41+
val lii = bar[Foo[List]]
42+
}
43+
44+
object Test4 {
45+
inline def summon[T] = implicit match {
46+
case t: T => t
47+
}
48+
49+
class Foo[F[t] >: List[t]]
50+
51+
inline def bar[T] = inline erasedValue[T] match {
52+
case _: Foo[f] => summon[f[Int]]
53+
}
54+
55+
implicit val li: List[Int] = List(1, 2, 3)
56+
val lii = bar[Foo[List]]
2557
}

0 commit comments

Comments
 (0)