Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Substituters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait Substituters { this: Context =>
val sym = tp.symbol
var fs = from
var ts = to
while (fs.nonEmpty) {
while (fs.nonEmpty && ts.nonEmpty) {
if (fs.head eq sym) return ts.head
fs = fs.tail
ts = ts.tail
Expand Down Expand Up @@ -203,7 +203,7 @@ trait Substituters { this: Context =>
val sym = tp.symbol
var fs = from
var ts = to
while (fs.nonEmpty) {
while (fs.nonEmpty && ts.nonEmpty) {
if (fs.head eq sym)
return ts.head match {
case TypeBounds(lo, hi) => range(lo, hi)
Expand Down
5 changes: 1 addition & 4 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4791,10 +4791,7 @@ object Types {

case tp @ AppliedType(tycon, args) =>
@tailrec def foldArgs(x: T, tparams: List[ParamInfo], args: List[Type]): T =
if (args.isEmpty) {
assert(tparams.isEmpty)
x
}
if (args.isEmpty || tparams.isEmpty) x
else {
val tparam = tparams.head
val acc = args.head match {
Expand Down
12 changes: 12 additions & 0 deletions tests/neg/i6063.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
object i0 {
trait I1[i0, I1]
def I1[I1[I1]](I1: I1[ ; // error
I1[I1]
}

object test {
object I0 {
trait i2[I1, i2]
def i2[i2[i2]](i2: i2[ ]) = i2 // error
i2[i2]}
}
4 changes: 4 additions & 0 deletions tests/neg/i6064.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait Trait[X] {
def f[C[_]](arg: C[X]): Int
val a = f[(Int, String)] // error
}