File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,9 @@ object Inferencing {
150
150
tree
151
151
}
152
152
153
+ def isSkolemFree (tp : Type )(implicit ctx : Context ): Boolean =
154
+ ! tp.existsPart(_.isInstanceOf [SkolemType ])
155
+
153
156
/** Derive information about a pattern type by comparing it with some variant of the
154
157
* static scrutinee type. We have the following situation in case of a (dynamic) pattern match:
155
158
*
Original file line number Diff line number Diff line change @@ -520,6 +520,7 @@ class Typer extends Namer
520
520
def isEligible (tp : Type ) = tp.exists && ! tp.typeSymbol.is(Final ) && ! tp.isRef(defn.AnyClass )
521
521
if (templ1.parents.isEmpty &&
522
522
isFullyDefined(pt, ForceDegree .noBottom) &&
523
+ isSkolemFree(pt) &&
523
524
isEligible(pt.underlyingClassRef(refinementOK = false )))
524
525
templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
525
526
templ1.parents foreach {
Original file line number Diff line number Diff line change
1
+ class A { class AProxy }
2
+
3
+ object B {
4
+ inline def head (a : A )(code : => a.AProxy ): Unit = code
5
+ head(new A )(new {}) // error: found: Object {...} required: ?1.AProxy
6
+
7
+ val a = new A
8
+ head(a)(new a.AProxy {}) // ok
9
+ }
You can’t perform that action at this time.
0 commit comments