aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/dotty/tools/dotc/core/Decorators.scala2
-rw-r--r--tests/neg/i2151.scala6
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala
index f8267072e..0e8ae196a 100644
--- a/compiler/src/dotty/tools/dotc/core/Decorators.scala
+++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala
@@ -103,7 +103,7 @@ object Decorators {
* as long as `xs`.
*/
def zipWithConserve[U](ys: List[U])(f: (T, U) => T): List[T] =
- if (xs.isEmpty) xs
+ if (xs.isEmpty || ys.isEmpty) Nil
else {
val x1 = f(xs.head, ys.head)
val xs1 = xs.tail.zipWithConserve(ys.tail)(f)
diff --git a/tests/neg/i2151.scala b/tests/neg/i2151.scala
new file mode 100644
index 000000000..1ae034c02
--- /dev/null
+++ b/tests/neg/i2151.scala
@@ -0,0 +1,6 @@
+trait Test {
+ type Nil = [K] => K
+ type StrangeCons[H, Tail <: [H, A] => H] = Tail[H, H]
+
+ def list: StrangeCons[Int, Nil] // error
+}