diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-02 21:44:59 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-02 21:45:05 +0200 |
commit | 160f63f3ceba49d4a0b9a24efbd162acc79fc9a7 (patch) | |
tree | 596d1ee63422300b18f6c8aeee15be10286d2a29 /src/dotty/tools/dotc/core/TypeOps.scala | |
parent | ac46a0e4489bba4f76863cc1491bf2b8441ed1cb (diff) | |
download | dotty-160f63f3ceba49d4a0b9a24efbd162acc79fc9a7.tar.gz dotty-160f63f3ceba49d4a0b9a24efbd162acc79fc9a7.tar.bz2 dotty-160f63f3ceba49d4a0b9a24efbd162acc79fc9a7.zip |
Fix #523: Instantiate lower bound when bounds checking
Lower bounds need to be instantiated just like upper bounds.
F-bounded polymorphism (which only applies too upper bounds)
is one reason for instantiating arguments, but parameters
referring to other parameters is another one. An the latter
applies to lower bounds as well.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 3 |
1 files changed, 2 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) |