Skip to content

Commit 220fe53

Browse files
committed
Fix #522.
We were missing a substitution in full parameterization. Embarraingly, this made even the example in the doc comment of `fullyParameterizedDef` fail.
1 parent bb6582b commit 220fe53

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/dotty/tools/dotc/transform/FullParameterization.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ trait FullParameterization {
116116
info match {
117117
case info @ PolyType(mtnames) =>
118118
PolyType(mtnames ++ ctnames)(
119-
pt => (info.paramBounds ++ mappedClassBounds(pt))
120-
.mapConserve(_.subst(info, pt).bounds),
119+
pt =>
120+
(info.paramBounds.map(mapClassParams(_, pt).bounds) ++
121+
mappedClassBounds(pt)).mapConserve(_.subst(info, pt).bounds),
121122
pt => resultType(mapClassParams(_, pt)).subst(info, pt))
122123
case _ =>
123124
if (ctparams.isEmpty) resultType(identity)

tests/pos/extmethods.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ class T[A, This <: That1[A]](val x: Int) extends AnyVal {
55
final def loop(x: This, cnt: Int): Int = loop(x, cnt + 1)
66
def const[B](): Boolean = return true
77
}
8+
9+
final class TraversableOnceOps[+A](val collection: TraversableOnce[A]) extends AnyVal {
10+
def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] =
11+
if (collection.isEmpty) None else Some(collection.reduceLeft[B](op))
12+
}
13+
14+
class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal {
15+
def baz[B >: A](x: B): List[B] = ???
16+
}
17+

0 commit comments

Comments
 (0)