views:

77

answers:

1

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)
+3  A: 

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.

Randall Schulz
This solution doesn't work.
isola009
@isola009: You're going to have to say more. What specifically did you try. What error resulted?
Randall Schulz