//
// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// Candidate.hpp --
//
// Author           : Aaron B. Moss
// Created On       : Wed Jun 5 14:30:00 2019
// Last Modified By : Aaron B. Moss
// Last Modified On : Wed Jun 5 14:30:00 2019
// Update Count     : 1
//

#pragma once

#include <iosfwd>
#include <memory>        // for shared_ptr
#include <vector>

#include "Cost.h"
#include "AST/Node.hpp"
#include "AST/TypeEnvironment.hpp"
#include "Common/Indenter.h"

namespace ast {
	class Expr;

	/// A list of unresolved assertions
	using AssertionList = std::vector<AssertionSet::value_type>;
}

namespace ResolvExpr {

/// One option for resolution of an expression
struct Candidate {
	ast::ptr<ast::Expr> expr;  ///< Satisfying expression
	Cost cost;                 ///< Cost of the whole expression
	Cost cvtCost;              ///< Cost of conversions to satisfying expression
	ast::TypeEnvironment env;  ///< Containing type environment
	ast::OpenVarSet open;      ///< Open variables for environment
	ast::AssertionList need;   ///< Assertions which need to be resolved
};

/// Shared reference to a candidate
using CandidateRef = std::shared_ptr< Candidate >;

/// List of candidates
using CandidateList = std::vector< CandidateRef >;

void print( std::ostream & os, const Candidate & cand, Indenter indent = {} );

void print( std::ostream & os, const CandidateList & cands, Indenter indent = {} );

} // namespace ResolvExpr

// Local Variables: //
// tab-width: 4 //
// mode: c++ //
// compile-command: "make install" //
// End: //
