File tree 4 files changed +15
-0
lines changed
compiler/src/dotty/tools/dotc/typer
4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,13 @@ class Namer { typer: Typer =>
289
289
val preExisting = owner.unforcedDecls.lookup(name)
290
290
if (preExisting.isDefinedInCurrentRun || preExisting.lastKnownDenotation.is(Package ))
291
291
&& (! preExisting.lastKnownDenotation.is(Private ) || preExisting.owner.is(Package ))
292
+ && (! preExisting.lastKnownDenotation.isPackageObject
293
+ || preExisting.associatedFile != ctx.source.file)
294
+ // isDefinedInCurrentRun does not work correctly for package objects, because
295
+ // package objects are updated to the new run earlier than normal classes, everytime
296
+ // some member of the enclosing package is accessed. Therefore, we use another
297
+ // test: conflict if package objects have the same name but come from different
298
+ // sources. See i9252.
292
299
then conflict(preExisting)
293
300
294
301
def pkgObjs (pkg : Symbol ) =
Original file line number Diff line number Diff line change
1
+ class Clazz {
2
+ def foo = Macro .expand()
3
+ }
Original file line number Diff line number Diff line change
1
+ object Macro {
2
+ inline def expand (): Unit = $ {impl}
3
+ def impl (using scala.quoted.QuoteContext ) = ' {??? }
4
+ }
Original file line number Diff line number Diff line change
1
+ def fct : Unit = Macro .expand()
You can’t perform that action at this time.
0 commit comments