aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala3
-rw-r--r--tests/pos/i523.scala8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 2b6ea49e8..1adabbd2d 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -352,10 +352,11 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
//println(i"instantiating ${bounds.hi} with $argTypes")
//println(i" = ${instantiate(bounds.hi, argTypes)}")
val hiBound = instantiate(bounds.hi, argTypes.mapConserve(_.bounds.hi))
+ val loBound = instantiate(bounds.lo, argTypes.mapConserve(_.bounds.lo))
// Note that argTypes can contain a TypeBounds type for arguments that are
// not fully determined. In that case we need to check against the hi bound of the argument.
if (!(lo <:< hiBound)) violations += ((arg, "upper", hiBound))
- if (!(bounds.lo <:< hi)) violations += ((arg, "lower", bounds.lo))
+ if (!(loBound <:< hi)) violations += ((arg, "lower", bounds.lo))
}
arg.tpe match {
case TypeBounds(lo, hi) => checkOverlapsBounds(lo, hi)
diff --git a/tests/pos/i523.scala b/tests/pos/i523.scala
new file mode 100644
index 000000000..b22358821
--- /dev/null
+++ b/tests/pos/i523.scala
@@ -0,0 +1,8 @@
+class X
+class A {
+ def foo[T1, T2 >: T1]: Unit = {}
+
+ def test = {
+ foo[X, X]
+ }
+}