diff --git a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala index a304fa9f5705..ed04145c1d02 100644 --- a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala +++ b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala @@ -498,7 +498,9 @@ class OrderingConstraint(private val boundsMap: ParamBounds, (this.typeVarOfParam(tl.paramRefs(0)) ne that.typeVarOfParam(tl.paramRefs(0))) def subst(from: TypeLambda, to: TypeLambda)(using Context): OrderingConstraint = - def swapKey[T](m: ArrayValuedMap[T]) = m.remove(from).updated(to, m(from).nn) + def swapKey[T](m: ArrayValuedMap[T]) = + val info = m(from) + if info == null then m else m.remove(from).updated(to, info) var current = newConstraint(swapKey(boundsMap), swapKey(lowerMap), swapKey(upperMap)) def subst[T <: Type](x: T): T = x.subst(from, to).asInstanceOf[T] current.foreachParam {(p, i) => diff --git a/tests/pos/i15845/config/State.scala b/tests/pos/i15845/config/State.scala new file mode 100644 index 000000000000..ed907b7e899e --- /dev/null +++ b/tests/pos/i15845/config/State.scala @@ -0,0 +1,11 @@ +package config + +import state._ + +object State { + + object Info { + def apply(): Info = Info(Config(), Seq.empty) + } + case class Info(cfg: AnyRef, allTypes: Seq[AnyRef]) +} diff --git a/tests/pos/i15845/config/state/Config.scala b/tests/pos/i15845/config/state/Config.scala new file mode 100644 index 000000000000..4b0e11d7d191 --- /dev/null +++ b/tests/pos/i15845/config/state/Config.scala @@ -0,0 +1,4 @@ +package config +package state + +case class Config(simulations: Seq[(String, Any)] = Seq.empty)