File tree 3 files changed +20
-2
lines changed
compiler/src/dotty/tools/dotc/core
3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,13 @@ object TypeOps:
175
175
val normed = tp.tryNormalize
176
176
if (normed.exists) normed else mapOver
177
177
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)
179
185
case tp : SkolemType =>
180
186
// Mapping over a skolem creates a new skolem which by definition won't
181
187
// be =:= to the original one.
Original file line number Diff line number Diff line change @@ -1892,7 +1892,8 @@ object Types {
1892
1892
* but its simplification is `Serializable`). This means that simplification
1893
1893
* should never be used in a `MethodicType`, because that could
1894
1894
* 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.
1896
1897
*/
1897
1898
def simplified (using Context ): Type = TypeOps .simplify(this , null )
1898
1899
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