| 1 | //
 | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
 | 
|---|
| 3 | //
 | 
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
| 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
| 6 | //
 | 
|---|
| 7 | // Unify.hpp --
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // Author           : Richard C. Bilson
 | 
|---|
| 10 | // Created On       : Sun May 17 13:09:04 2015
 | 
|---|
| 11 | // Last Modified By : Andrew Beach
 | 
|---|
| 12 | // Last Modified On : Tue Jan 17 11:12:00 2023
 | 
|---|
| 13 | // Update Count     : 5
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #pragma once
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #include "AST/Node.hpp"             // for ptr
 | 
|---|
| 19 | #include "AST/TypeEnvironment.hpp"  // for TypeEnvironment, AssertionSet, OpenVarSet
 | 
|---|
| 20 | #include "WidenMode.hpp"            // for WidenMode
 | 
|---|
| 21 | 
 | 
|---|
| 22 | namespace ast {
 | 
|---|
| 23 |         class SymbolTable;
 | 
|---|
| 24 |         class Type;
 | 
|---|
| 25 | }
 | 
|---|
| 26 | 
 | 
|---|
| 27 | namespace ResolvExpr {
 | 
|---|
| 28 | 
 | 
|---|
| 29 | bool unify(
 | 
|---|
| 30 |         const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
 | 
|---|
| 31 |         ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
 | 
|---|
| 32 |         ast::OpenVarSet & open );
 | 
|---|
| 33 | 
 | 
|---|
| 34 | bool unify(
 | 
|---|
| 35 |         const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
 | 
|---|
| 36 |         ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
 | 
|---|
| 37 |         ast::OpenVarSet & open, ast::ptr<ast::Type> & common );
 | 
|---|
| 38 | 
 | 
|---|
| 39 | bool unifyExact(
 | 
|---|
| 40 |         const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
 | 
|---|
| 41 |         ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open,
 | 
|---|
| 42 |         WidenMode widen );
 | 
|---|
| 43 | 
 | 
|---|
| 44 | bool unifyInexact(
 | 
|---|
| 45 |         const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
 | 
|---|
| 46 |         ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
 | 
|---|
| 47 |         const ast::OpenVarSet & open, WidenMode widen,
 | 
|---|
| 48 |         ast::ptr<ast::Type> & common );
 | 
|---|
| 49 | 
 | 
|---|
| 50 | bool typesCompatible(
 | 
|---|
| 51 |         const ast::Type *, const ast::Type *,
 | 
|---|
| 52 |         const ast::TypeEnvironment & env = {} );
 | 
|---|
| 53 | 
 | 
|---|
| 54 | bool typesCompatibleIgnoreQualifiers(
 | 
|---|
| 55 |         const ast::Type *, const ast::Type *,
 | 
|---|
| 56 |         const ast::TypeEnvironment & env = {} );
 | 
|---|
| 57 | 
 | 
|---|
| 58 | /// Creates or extracts the type represented by returns in a `FunctionType`.
 | 
|---|
| 59 | ast::ptr<ast::Type> extractResultType( const ast::FunctionType * func );
 | 
|---|
| 60 | 
 | 
|---|
| 61 | std::vector<ast::ptr<ast::Type>> flattenList(
 | 
|---|
| 62 |         const std::vector<ast::ptr<ast::Type>> & src, ast::TypeEnvironment & env
 | 
|---|
| 63 | );
 | 
|---|
| 64 | 
 | 
|---|
| 65 | } // namespace ResolvExpr
 | 
|---|
| 66 | 
 | 
|---|
| 67 | // Local Variables: //
 | 
|---|
| 68 | // tab-width: 4 //
 | 
|---|
| 69 | // mode: c++ //
 | 
|---|
| 70 | // compile-command: "make install" //
 | 
|---|
| 71 | // End: //
 | 
|---|