Skip to content

Commit 23826f5

Browse files
committed
fix #11331
(also split the test from #11335)
1 parent 0273336 commit 23826f5

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,9 @@ object SymDenotations {
22072207
if !myCompanion.exists then
22082208
ensureCompleted()
22092209
myCompanion
2210-
override def registeredCompanion_=(c: Symbol) = { myCompanion = c }
2210+
2211+
override def registeredCompanion_=(c: Symbol) =
2212+
myCompanion = c
22112213

22122214
private var myNestingLevel = -1
22132215

@@ -2458,6 +2460,7 @@ object SymDenotations {
24582460
|| owner.isRefinementClass
24592461
|| owner.is(Scala2x)
24602462
|| owner.unforcedDecls.contains(denot.name, denot.symbol)
2463+
|| (denot.is(Synthetic) && denot.is(ModuleClass) && stillValidInOwner(denot.companionClass))
24612464
|| denot.isSelfSym
24622465
|| denot.isLocalDummy)
24632466
catch case ex: StaleSymbol => false

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class BootstrappedOnlyCompilationTests {
2828
compileFilesInDir("tests/pos-macros", defaultOptions),
2929
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Xsemanticdb")),
3030
compileDir("tests/pos-special/i7592", defaultOptions.and("-Yretain-trees")),
31+
compileDir("tests/pos-special/i11331.1", defaultOptions),
3132
).checkCompile()
3233
}
3334

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package i11331
2+
3+
import scala.quoted._
4+
5+
class I11331Class
6+
7+
8+
object X:
9+
10+
inline def process[T](inline f:T) = ${
11+
processImpl[T]('f)
12+
}
13+
14+
def processImpl[T:Type](t:Expr[T])(using Quotes):Expr[T] =
15+
import quotes.reflect._
16+
t
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package i11331
2+
3+
4+
object Main:
5+
6+
def main(args:Array[String]):Unit =
7+
X.process{
8+
val a = new I11331Class
9+
a
10+
}

0 commit comments

Comments
 (0)