Skip to content

Commit c57e8eb

Browse files
committed
Supply dummy arguments for the call
1 parent 73a8a6e commit c57e8eb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ object Semantic:
855855
// init "fake" param fields for parameters of primary and secondary constructors
856856
def addParamsAsFields(args: List[Value], ref: Ref, ctorDef: DefDef) =
857857
val params = ctorDef.termParamss.flatten.map(_.symbol)
858-
assert(args.size == params.size, "arguments = " + args.size + ", params = " + params.size)
858+
assert(args.size == params.size, "arguments = " + args.size + ", params = " + params.size + ", ctro = " + ctor.show)
859859
for (param, value) <- params.zip(args) do
860860
ref.updateField(param, value)
861861
printer.println(param.show + " initialized with " + value)
@@ -1663,12 +1663,13 @@ object Semantic:
16631663
// term arguments to B. That can only be done in a concrete class.
16641664
val tref = typeRefOf(klass.typeRef.baseType(mixin).typeConstructor)
16651665
val ctor = tref.classSymbol.primaryConstructor
1666-
if ctor.exists && ctor.paramSymss.isEmpty then
1666+
if ctor.exists then
16671667
// The parameter check of traits comes late in the mixin phase.
1668-
// To avoid crash we ignore the initialization check for erroneous
1669-
// parent call code. See tests/neg/i16438.scala.
1668+
// To avoid crash we supply hot values for erroneous parent calls.
1669+
// See tests/neg/i16438.scala.
1670+
val args: List[ArgInfo] = ctor.info.paramInfoss.flatten.map(_ => ArgInfo(Hot, Trace.empty))
16701671
extendTrace(superParent) {
1671-
superCall(tref, ctor, args = Nil, tasks)
1672+
superCall(tref, ctor, args, tasks)
16721673
}
16731674
}
16741675

0 commit comments

Comments
 (0)