Skip to content

Commit bce0233

Browse files
committed
Avoid case _: C[_]#K type test for higher-kinded C
The code compiles fine with vanilla 2.12.15, but fails when enabling the semanticdb compiler plugin. I assume the plugin forces some `TypeTreeWithDeferredRefCheck` that's otherwise left alone. The deferred refcheck is created here: https://github.com/scala/scala/blob/v2.12.15/src/compiler/scala/tools/nsc/typechecker/Typers.scala#L5167
1 parent 284cc56 commit bce0233

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

library/src/scala/collection/immutable/TreeMap.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,10 @@ final class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering:
404404
}
405405
private def sameCBF(bf: CanBuildFrom[_,_,_]): Boolean = {
406406
bf match {
407-
case cbf: SortedMapFactory[_]#SortedMapCanBuildFrom[_,_] => {
407+
case cbf: TreeMap.SortedMapCanBuildFrom[_, _] =>
408408
val factory:AnyRef = cbf.factory
409409
((factory eq TreeMap) || (factory eq immutable.SortedMap) || (factory eq collection.SortedMap)) &&
410410
cbf.ordering == ordering
411-
}
412411
case w: WrappedCanBuildFrom[_,_,_] => sameCBF(w.wrapped)
413412
case _ => false
414413
}

library/src/scala/collection/immutable/TreeSet.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,10 @@ final class TreeSet[A] private[immutable] (private[immutable] val tree: RB.Tree[
264264

265265
private def sameCBF(bf: CanBuildFrom[_,_,_]): Boolean = {
266266
bf match {
267-
case cbf: SortedSetFactory[_]#SortedSetCanBuildFrom[_] => {
267+
case cbf: TreeSet.SortedSetCanBuildFrom[_] =>
268268
val factory:AnyRef = cbf.factory
269269
((factory eq TreeSet) || (factory eq immutable.SortedSet) || (factory eq collection.SortedSet)) &&
270270
cbf.ordering == ordering
271-
}
272271
case w: WrappedCanBuildFrom[_,_,_] => sameCBF(w.wrapped)
273272
case _ => false
274273
}

0 commit comments

Comments
 (0)