File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import dotty.tools.dotc.core.Decorators._
1010import dotty .tools .dotc .core .Flags .Package
1111import dotty .tools .dotc .core .NameKinds .FlatName
1212import dotty .tools .dotc .core .Names .Name
13+ import dotty .tools .dotc .core .StdNames .str .MODULE_INSTANCE_FIELD
1314import dotty .tools .dotc .core .quoted ._
1415import dotty .tools .dotc .core .Types ._
1516import dotty .tools .dotc .core .Symbols ._
@@ -130,7 +131,9 @@ object Splicer {
130131 private def loadModule (sym : Symbol ): (Class [_], Object ) = {
131132 if (sym.owner.is(Package )) {
132133 // is top level object
133- (loadClass(sym.companionModule.fullName), null )
134+ val moduleClass = loadClass(sym.fullName)
135+ val moduleInstance = moduleClass.getField(MODULE_INSTANCE_FIELD ).get(null )
136+ (moduleClass, moduleInstance)
134137 } else {
135138 // nested object in an object
136139 val clazz = loadClass(sym.fullNameSeparated(FlatName ))
Original file line number Diff line number Diff line change 1+ Ok
Original file line number Diff line number Diff line change 1+
2+ trait Index
3+
4+ object Index {
5+ inline def succ (prev : Index ): Unit = ~ { '(println("Ok")) }
6+ }
Original file line number Diff line number Diff line change 1+
2+ object Test {
3+ def main (args : Array [String ]): Unit = {
4+ Index .succ(null )
5+ }
6+ }
You can’t perform that action at this time.
0 commit comments