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
8 changes: 6 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3858,8 +3858,12 @@ object Types extends TypeUtils {

override final def derivedSelect(tp: NamedType, pre: Type): Type =
if tp.prefix eq pre then tp
else if tp.symbol.exists then NamedType(pre, tp.name, tp.denot.asSeenFrom(pre))
else NamedType(pre, tp.name)
else
pre match
case ref: ParamRef if (ref.binder eq self) && tp.symbol.exists =>
NamedType(pre, tp.name, tp.denot.asSeenFrom(pre))
case _ =>
tp.derivedSelect(pre)

final def derivedLambdaType(paramNames: List[ThisName] = this.paramNames,
paramInfos: List[PInfo] = this.paramInfos,
Expand Down
18 changes: 18 additions & 0 deletions tests/pos/23056.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def Test = {
val ops: CompileOps[Option, Option, Any] = ???
ops.to(List).map(_.reverse) // error
}

trait CompileOps[F[_], G[_], O]:
def to(collector: Collector[O]): G[collector.Out]
trait Collector[-A] {
type Out
}

object Collector:
type Aux[A, X] = Collector[A] { type Out = X }

given [A, C[_]]: Conversion[
scala.collection.IterableFactory[C],
Collector.Aux[A, C[A]]
] = ???
Loading