diff options
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | test/dotc/tests.scala | 1 | ||||
-rw-r--r-- | tests/neg/implicit-lower-bound.scala | 14 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 61ab1133b..4d6a7e22b 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -3118,6 +3118,8 @@ object Types { apply(foldOver(maybeAdd(x, tp), tp), tp.underlying) case tp: TypeRef => foldOver(maybeAdd(x, tp), tp) + case TypeBounds(_, hi) => + apply(x, hi) case tp: ThisType => apply(x, tp.underlying) case tp: ConstantType => diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 2baeeb49e..fbf26044c 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -144,6 +144,7 @@ class tests extends CompilerTest { @Test def neg_traitParamsTyper = compileFile(negDir, "traitParamsTyper", xerrors = 5) @Test def neg_traitParamsMixin = compileFile(negDir, "traitParamsMixin", xerrors = 2) @Test def neg_firstError = compileFile(negDir, "firstError", xerrors = 3) + @Test def neg_implicitLowerBound = compileFile(negDir, "implicit-lower-bound", xerrors = 1) @Test def run_all = runFiles(runDir) diff --git a/tests/neg/implicit-lower-bound.scala b/tests/neg/implicit-lower-bound.scala new file mode 100644 index 000000000..4d5e6389c --- /dev/null +++ b/tests/neg/implicit-lower-bound.scala @@ -0,0 +1,14 @@ +class Foo + +class Bar extends Foo +object Bar { + implicit val listbar: List[Bar] = ??? +} + +class Test { + def get1(implicit lf: List[_ <: Bar]) = {} + def get2(implicit lf: List[_ >: Bar]) = {} + + get1 // works + get2 // error +} |