File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,13 @@ object TypeOps:
175175 val normed = tp.tryNormalize
176176 if (normed.exists) normed else mapOver
177177 case tp : MethodicType =>
178- tp // See documentation of `Types#simplified`
178+ // See documentation of `Types#simplified`
179+ val addTypeVars = new TypeMap :
180+ val constraint = ctx.typerState.constraint
181+ def apply (t : Type ): Type = t match
182+ case t : TypeParamRef => constraint.typeVarOfParam(t).orElse(t)
183+ case _ => this .mapOver(t)
184+ addTypeVars(tp)
179185 case tp : SkolemType =>
180186 // Mapping over a skolem creates a new skolem which by definition won't
181187 // be =:= to the original one.
Original file line number Diff line number Diff line change @@ -1892,7 +1892,8 @@ object Types {
18921892 * but its simplification is `Serializable`). This means that simplification
18931893 * should never be used in a `MethodicType`, because that could
18941894 * lead to a different `signature`. Since this isn't very useful anyway,
1895- * this method handles this by never simplifying inside a `MethodicType`.
1895+ * this method handles this by never simplifying inside a `MethodicType`,
1896+ * except for replacing type parameters with associated type variables.
18961897 */
18971898 def simplified (using Context ): Type = TypeOps .simplify(this , null )
18981899
Original file line number Diff line number Diff line change 1+ import reflect .Selectable .reflectiveSelectable
2+
3+ trait Foo :
4+ def f (): Long
5+
6+ def h () = k((_ : Foo ) => ??? )
7+
8+ trait Bar [TB ]
9+ given Bar [Foo ] = ???
10+
11+ def k [Tk , Ptr <: { def f (): Tk }](function : Ptr => Int )(using alloc : Bar [Ptr ]): Tk = ???
You can’t perform that action at this time.
0 commit comments