File tree 2 files changed +10
-0
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2546,6 +2546,10 @@ class Typer extends Namer
2546
2546
pid1 match
2547
2547
case pid1 : RefTree if pkg.is(Package ) =>
2548
2548
inContext(ctx.packageContext(tree, pkg)) {
2549
+ // If it exists, complete the class containing the top-level definitions
2550
+ // before typing any statement in the package to avoid cycles as in i13669.scala
2551
+ val topLevelClassName = desugar.packageObjectName(ctx.source).moduleClassName
2552
+ pkg.moduleClass.info.decls.lookup(topLevelClassName).ensureCompleted()
2549
2553
var stats1 = typedStats(tree.stats, pkg.moduleClass)._1
2550
2554
if (! ctx.isAfterTyper)
2551
2555
stats1 = stats1 ++ typedBlockStats(MainProxies .mainProxies(stats1))._1
Original file line number Diff line number Diff line change
1
+ trait MyExtensions :
2
+ extension (lhs : Int ) def bash : Unit = {}
3
+ object MyExtensions extends MyExtensions
4
+
5
+ export MyExtensions .*
6
+ val fails = 1 .bash
You can’t perform that action at this time.
0 commit comments