File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,13 @@ object TypeOps:
461
461
def makePackageObjPrefixExplicit (tpe : NamedType )(using Context ): Type = {
462
462
def tryInsert (pkgClass : SymDenotation ): Type = pkgClass match {
463
463
case pkg : PackageClassDenotation =>
464
- val pobj = pkg.packageObjFor(tpe.symbol)
464
+ var sym = tpe.symbol
465
+ if ! sym.exists && tpe.denot.isOverloaded then
466
+ // we know that all alternatives must come from the same package object, since
467
+ // otherwise we would get "is already defined" errors. So we can take the first
468
+ // symbol we see.
469
+ sym = tpe.denot.alternatives.head.symbol
470
+ val pobj = pkg.packageObjFor(sym)
465
471
if (pobj.exists) tpe.derivedSelect(pobj.termRef)
466
472
else tpe
467
473
case _ =>
Original file line number Diff line number Diff line change
1
+ package sudoku
2
+
3
+ final case class SudokuField (sudoku : Int )
4
+
5
+ // This form compiles only when package.scala is commented.
6
+ // This form compiles with error when package.scala is uncommented.
7
+ implicit class SudokuFieldOps (val sudokuField : SudokuField ) extends AnyVal {
8
+ def foo : Int = ???
9
+ }
Original file line number Diff line number Diff line change
1
+ package object sudoku {}
You can’t perform that action at this time.
0 commit comments