File tree 4 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform
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._
10
10
import dotty .tools .dotc .core .Flags .Package
11
11
import dotty .tools .dotc .core .NameKinds .FlatName
12
12
import dotty .tools .dotc .core .Names .Name
13
+ import dotty .tools .dotc .core .StdNames .str .MODULE_INSTANCE_FIELD
13
14
import dotty .tools .dotc .core .quoted ._
14
15
import dotty .tools .dotc .core .Types ._
15
16
import dotty .tools .dotc .core .Symbols ._
@@ -130,7 +131,9 @@ object Splicer {
130
131
private def loadModule (sym : Symbol ): (Class [_], Object ) = {
131
132
if (sym.owner.is(Package )) {
132
133
// 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)
134
137
} else {
135
138
// nested object in an object
136
139
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