I'm using a priority queue to order a case class called TreeNodeWithCostAndHeuristic
case class TreeNodeWithCostAndHeuristic[S,A](parent:Option[TreeNodeWithCostAndHeuristic[S,A]],
action: Option[A],
state: S,
cost: Double,
estimatedRemainingCost: Double)
This priority queue is created inside a function that uses its parameter to set the initial state while the other values have to be kept as None or 0
def HeuristicGraphSearch[S,A](problem: ProblemWithCostAndHeuristic[S,A]) = {
val root = TreeNodeWithCostAndHeuristic(parent = None,action=None,state=problem.initialState,cost = 0.0, estimatedRemainingCost = 0.0)
val frontier : mutable.PriorityQueue[TreeNodeWithCostAndHeuristic[S,A]] = mutable.PriorityQueue.empty[TreeNodeWithCostAndHeuristic[S,A]]
frontier.enqueue(root)
However because parent and action are none I get a mismatch between expected type TreeNodeWithCostAndHeuristic[S,A] and the one I'm trying to enqueue TreeNodeWithCostAndHeuristic[S,Nothing].
As far as I know Nothing is a subtype of Option and in my case class both parent and action are options. Why am I getting the mismatch?