Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3615,6 +3615,19 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val packageObjectName = desugar.packageObjectName(ctx.source)
val topLevelClassSymbol = pkg.moduleClass.info.decls.lookup(packageObjectName.moduleClassName)
topLevelClassSymbol.ensureCompleted()
// When sibling files in this package come from the classpath (TASTy),
// force their `<src>$package` classes now to avoid cross-unit cycles
// as in #25894: otherwise the first lookup on this package (e.g. an
// import qualifier at the top of this file) forces them during the
// import's completer, and their unpickling can chain through source
// exports back to the import itself.
if !pkg.isEffectiveRoot && pkg != defn.EmptyPackageVal then
pkg.moduleClass.denot match
case pcd: SymDenotations.PackageClassDenotation =>
for pobj <- pcd.packageObjs do
if pobj.symbol.isDefinedInBinary then
pobj.symbol.ensureCompleted()
case _ =>
var stats1 = typedStats(tree.stats, pkg.moduleClass)._1
if (!ctx.isAfterTyper)
stats1 = stats1 ++ typedBlockStats(MainProxies.proxies(stats1))._1
Expand Down
15 changes: 15 additions & 0 deletions tests/pos/i25894/DFVal_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dfhdl

final class DFVal[+T <: DFType, +M]

type DFValAny = DFVal[DFType, ModifierAny]
type DFConstOf[+T <: DFType] = DFVal[T, Modifier.CONST]
type DFValTP[+T <: DFType] = DFVal[T, Modifier]

inline def x = ${ ??? }

object DFVal:
export DFXInt.Ops.{c1, c2}
object Ops:
type BoolOnlyOp
type CarryOp
2 changes: 2 additions & 0 deletions tests/pos/i25894/MutableDB_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package dfhdl
class MutableDB
6 changes: 6 additions & 0 deletions tests/pos/i25894/hdl_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dfhdl
object hdl:
export DFBoolOrBit.given
export DFDecimal.Ops.*

export hdl.*
34 changes: 34 additions & 0 deletions tests/pos/i25894/stubs_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package dfhdl
import DFVal.Ops.CarryOp
import DFVal.Ops.BoolOnlyOp

trait ExactOp2Aux[Op, C, O]

trait Modifier
type ModifierAny = Modifier
object Modifier:
type CONST = Modifier

class DFType

class DFC(mutableDB: MutableDB)

object DFBoolOrBit:
given bl[Op, O](using
ExactOp2Aux[Op, DFC, O]
): ExactOp2Aux[BoolOnlyOp, DFC, O] = ???

object DFDecimal:
object Ops:
export DFXInt.Ops.*

object DFXInt:
object Ops:
type A = Int
type B = String
given arith1[Op <: A]: ExactOp2Aux[Op, DFC, DFValTP[DFType]] = ???
given arith2[Op <: B]: ExactOp2Aux[Op, DFC, DFValTP[DFType]] = ???
given c1: ExactOp2Aux[CarryOp, DFC, DFValTP[DFType]] = ???
given c2: ExactOp2Aux[CarryOp, DFC, DFValTP[DFType]] = ???

type DFConstInt32 = DFConstOf[DFType]
34 changes: 34 additions & 0 deletions tests/pos/i25894/stubs_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package dfhdl
import DFVal.Ops.CarryOp
import DFVal.Ops.BoolOnlyOp

trait ExactOp2Aux[Op, C, O]

trait Modifier
type ModifierAny = Modifier
object Modifier:
type CONST = Modifier

class DFType

class DFC(mutableDB: MutableDB)

object DFBoolOrBit:
given bl[Op, O](using
ExactOp2Aux[Op, DFC, O]
): ExactOp2Aux[BoolOnlyOp, DFC, O] = ???

object DFDecimal:
object Ops:
export DFXInt.Ops.*

object DFXInt:
object Ops:
type A = Int
type B = String
given arith1[Op <: A]: ExactOp2Aux[Op, DFC, DFValTP[DFType]] = ???
given arith2[Op <: B]: ExactOp2Aux[Op, DFC, DFValTP[DFType]] = ???
given c1: ExactOp2Aux[CarryOp, DFC, DFValTP[DFType]] = ???
given c2: ExactOp2Aux[CarryOp, DFC, DFValTP[DFType]] = ???

type DFConstInt32 = DFConstOf[DFType]
Loading