Skip to content

Commit e989217

Browse files
committed
Skip splice level checking for <refinement> symbols
This is safe to skip because <refinement> symbols can only be a part of type refinement (where they reference that type), where it is impossible to splice anything.
1 parent 9e7aab7 commit e989217

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)