Skip to content

Commit db6fb45

Browse files
committed
Fix #2151: don't die for wrong number of typeargs applied
1 parent f49c10d commit db6fb45

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ object Decorators {
103103
* as long as `xs`.
104104
*/
105105
def zipWithConserve[U](ys: List[U])(f: (T, U) => T): List[T] =
106-
if (xs.isEmpty) xs
106+
if (xs.isEmpty || ys.isEmpty) Nil
107107
else {
108108
val x1 = f(xs.head, ys.head)
109109
val xs1 = xs.tail.zipWithConserve(ys.tail)(f)

tests/neg/i2151.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
trait Test {
2+
type Nil = [K] => K
3+
type StrangeCons[H, Tail <: [H, A] => H] = Tail[H, H]
4+
5+
def list: StrangeCons[Int, Nil] // error
6+
}

0 commit comments

Comments
 (0)