File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,12 @@ object TypeOps:
125125 }
126126
127127 def isLegalPrefix (pre : Type )(using Context ): Boolean =
128+ // This used to be `pre.isStable || !ctx.phase.isTyper` but the latter
129+ // condition was dropped in #21954 to make implicit search during the
130+ // inlining phase behave more like implicit search during the typer phase.
131+ // However, this change has led to retyping issues (#23423) and I suspect
132+ // other issues could crop up as we might end up calling asSeenFrom with a
133+ // widened prefix in various situations post-typer.
128134 pre.isStable
129135
130136 /** Implementation of Types#simplified */
Original file line number Diff line number Diff line change @@ -32,12 +32,14 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap {
3232 */
3333 def apply (tp : Type ): Type =
3434 tp match
35- case NonSpliceAlias (aliased) => this .apply(aliased)
36- case tp : TypeRef => healTypeRef(tp)
37- case tp : TermRef =>
38- val inconsistentRoot = levelInconsistentRootOfPath(tp)
39- if inconsistentRoot.exists then levelError(inconsistentRoot, tp, pos)
40- else mapOver(tp)
35+ case tp : NamedType if tp.symbol.isLocal => tp match
36+ case NonSpliceAlias (aliased) =>
37+ this .apply(aliased)
38+ case tp : TypeRef => healTypeRef(tp)
39+ case tp : TermRef =>
40+ val inconsistentRoot = levelInconsistentRootOfPath(tp)
41+ if inconsistentRoot.exists then levelError(inconsistentRoot, tp, pos)
42+ else mapOver(tp)
4143 case tp : AnnotatedType =>
4244 derivedAnnotatedType(tp, apply(tp.parent), tp.annot)
4345 case _ =>
Original file line number Diff line number Diff line change 1+ package pkg
2+
3+ import scala .quoted .*
4+
5+ trait HasElem {
6+ type Elem
7+ type Alias = Elem
8+ }
9+
10+ object Macro :
11+ inline def foo : Unit = $ {fooImpl}
12+ def fooImpl (using Quotes ): Expr [Unit ] =
13+ ' {
14+ val lll : (he : HasElem ) => he.Alias =
15+ (hx : HasElem ) => ???
16+ }
Original file line number Diff line number Diff line change 1+ object Test :
2+ def test : Unit = pkg.Macro .foo
3+ // used to be error:
4+ // Found: (hx: pkg.HasElem) => hx.Elem
5+ // Required: (he: pkg.HasElem) => he.Elem
6+
You can’t perform that action at this time.
0 commit comments