Skip to content

Commit 617efc9

Browse files
jchybtgodzik
authored andcommitted
Fix stale symbol crash on classes with package owner
[Cherry-picked b5a3151]
1 parent 511e8d2 commit 617efc9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ class Namer { typer: Typer =>
694694
enterSymbol(classConstructorCompanion(classSym.asClass))
695695
else
696696
for moduleSym <- companionVals do
697-
if moduleSym.is(Module) && !moduleSym.isDefinedInCurrentRun then
697+
if moduleSym.lastKnownDenotation.is(Module) && !moduleSym.isDefinedInCurrentRun then
698698
val companion =
699699
if needsConstructorProxies(classSym) then
700700
classConstructorCompanion(classSym.asClass)

tests/pos-macros/i20449/Macro.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import scala.quoted.*
2+
transparent inline def getTypeInfo[T]() = ${ getTypeInfoImpl[T] }
3+
def getTypeInfoImpl[T: Type](using ctx: Quotes): Expr[Unit] = '{ () }

tests/pos-macros/i20449/Main.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
class Wrapper1[A]
3+
val a = {
4+
getTypeInfo[Any]()
5+
val wrapper2 = Wrapper1[Any]()
6+
}

0 commit comments

Comments
 (0)