Skip to content

Commit 8f57ade

Browse files
committed
Turn off F-bound wildcard skolemizatiuon under Scala-2 mode
With skolemization we fail compiling the standard lib with: ``` [E057] Type Mismatch Error: /Users/odersky/workspace/dotty/tests/scala2-library/src/library/scala/collection/generic/ParMapFactory.scala:28:76 28 |abstract class ParMapFactory[CC[X, Y] <: ParMap[X, Y] with ParMapLike[X, Y, CC[X, Y], _]] | ^ |Type argument CC[X, Y] does not conform to upper bound scala.collection.parallel.ParMapLike[X, Y, LazyRef(CC[X, Y]), | collection.parallel.ParMapLike[X, Y, CC[X, Y], _]#Sequential |] & scala.collection.parallel.ParMap[X, Y] -- ``` I have no idea whether this bound is correct or not, and am not inclined to find out. But we clearly have to support it anyway under Scala-2 mode.
1 parent 841975b commit 8f57ade

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
271271
* type parameter corresponding to the wildcard.
272272
*/
273273
def skolemizeWildcardArgs(tps: List[Type], app: Type) = app match {
274-
case AppliedType(tycon, args) if tycon.typeSymbol.isClass =>
274+
case AppliedType(tycon, args) if tycon.typeSymbol.isClass && !scala2Mode =>
275275
tps.zipWithConserve(tycon.typeSymbol.typeParams) {
276276
(tp, tparam) => tp match {
277277
case _: TypeBounds => app.select(tparam)
@@ -321,6 +321,8 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
321321
def massage(tp: Type): Type = tp match {
322322
case tp @ AppliedType(tycon, args) =>
323323
tp.derivedAppliedType(tycon, skolemizeWildcardArgs(args, tp))
324+
case tp: AndOrType =>
325+
tp.derivedAndOrType(massage(tp.tp1), massage(tp.tp2))
324326
case _ => tp
325327
}
326328
def narrowBound(bound: Type, fromBelow: Boolean): Unit = {

0 commit comments

Comments
 (0)