Reputation: 3118
I have the following class:
class Step(kind:TipoStep.Value,
message:String = "",
study:List[Formula] = List(),
lastAdd:Set[Formula] = Set(),
lastDel:Set[Formula] = Set(),
add:List[Formula] = List(),
del:List[Formula] = List()
) {
def this(step:Step,
kind:TipoStep.Value,
message:String = "",
study:List[Formula] = List(),
lastAdd:Set[Formula] = Set(),
lastDel:Set[Formula] = Set()) = this(kind, message, study, lastAdd, lastDel, step.getAllAdd, step.getAllDel)
/* ... */
}
Compiler shows me folloging error:
error: ambiguous reference to overloaded definition,
both method init$default$5 in object Step of type => scala.collection.mutable.Set[org.lorea.pltl.formula.Formula]
and method init$default$5 in object Step of type => scala.collection.mutable.Set[org.lorea.pltl.formula.Formula]
match expected type scala.collection.mutable.Set[org.lorea.pltl.formula.Formula]
step = new Step(TipoStep.R_fixpoint, s, List(c1, c2), news)
Upvotes: 1
Views: 223
Reputation: 26486
The presence of multiple, like-typed formal parameters and the use of default values in your primary constructor make it ambiguous which formal constructor parameter is to be defaulted and which assigned the actual parameter.
One way to resolve it is to used named parameter assignments in the constructor invocation.
Upvotes: 3