Skip to content

Commit 81f610b

Browse files
authored
Merge pull request #471 from scala/backport-lts-3.3-22782
Backport "Skip splice level checking for <refinement> symbols" to 3.3 LTS
2 parents 36ef58c + 1bb7fe0 commit 81f610b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/src/dotty/tools/dotc/staging/HealType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap {
7676
tp match
7777
case tp @ NamedType(NoPrefix, _) if level > levelOf(tp.symbol) => tp.symbol
7878
case tp: NamedType if !tp.symbol.isStatic => levelInconsistentRootOfPath(tp.prefix)
79-
case tp: ThisType if level > levelOf(tp.cls) => tp.cls
79+
case tp: ThisType if level > levelOf(tp.cls) && !tp.cls.isRefinementClass => tp.cls
8080
case _ => NoSymbol
8181

8282
/** Try to heal reference to type `T` used in a higher level than its definition.

tests/pos/i22648.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.quoted.*
2+
3+
def fooImpl(using Quotes): Expr[Any] =
4+
'{
5+
new AnyRef {
6+
type T = Unit
7+
def make: T = ()
8+
def take(t: T): Unit = ()
9+
}: {
10+
type T
11+
def make: T
12+
def take(t: T): Unit
13+
}
14+
}

0 commit comments

Comments
 (0)