[a32b204] | 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 | // |
---|
[c92bdcc] | 7 | // Unify.hpp -- |
---|
[a32b204] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Sun May 17 13:09:04 2015 |
---|
[e563edf] | 11 | // Last Modified By : Andrew Beach |
---|
| 12 | // Last Modified On : Tue Jan 17 11:12:00 2023 |
---|
| 13 | // Update Count : 5 |
---|
[a32b204] | 14 | // |
---|
[51b7345] | 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[51b7345] | 17 | |
---|
[f474e91] | 18 | #include "AST/Node.hpp" // for ptr |
---|
[d76c588] | 19 | #include "AST/TypeEnvironment.hpp" // for TypeEnvironment, AssertionSet, OpenVarSet |
---|
[c92bdcc] | 20 | #include "WidenMode.hpp" // for WidenMode |
---|
[ea6332d] | 21 | |
---|
[d76c588] | 22 | namespace ast { |
---|
| 23 | class SymbolTable; |
---|
| 24 | class Type; |
---|
| 25 | } |
---|
[51b7345] | 26 | |
---|
| 27 | namespace ResolvExpr { |
---|
[e563edf] | 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, |
---|
[251ce80] | 32 | ast::OpenVarSet & open ); |
---|
[e563edf] | 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, |
---|
[251ce80] | 37 | ast::OpenVarSet & open, ast::ptr<ast::Type> & common ); |
---|
[e563edf] | 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, |
---|
[251ce80] | 42 | WidenMode widen ); |
---|
[e563edf] | 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, |
---|
[2908f08] | 47 | const ast::OpenVarSet & open, WidenMode widen, |
---|
[e563edf] | 48 | ast::ptr<ast::Type> & common ); |
---|
| 49 | |
---|
| 50 | bool typesCompatible( |
---|
[2908f08] | 51 | const ast::Type *, const ast::Type *, |
---|
[e563edf] | 52 | const ast::TypeEnvironment & env = {} ); |
---|
| 53 | |
---|
| 54 | bool typesCompatibleIgnoreQualifiers( |
---|
[251ce80] | 55 | const ast::Type *, const ast::Type *, |
---|
[e563edf] | 56 | const ast::TypeEnvironment & env = {} ); |
---|
[d76c588] | 57 | |
---|
[7b5694d] | 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 | |
---|
[51b7345] | 65 | } // namespace ResolvExpr |
---|
| 66 | |
---|
[a32b204] | 67 | // Local Variables: // |
---|
| 68 | // tab-width: 4 // |
---|
| 69 | // mode: c++ // |
---|
| 70 | // compile-command: "make install" // |
---|
| 71 | // End: // |
---|