[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 | // |
---|
[66f8528] | 7 | // Unify.h -- |
---|
[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 | |
---|
[ea6332d] | 18 | #include <list> // for list |
---|
| 19 | |
---|
[f474e91] | 20 | #include "AST/Node.hpp" // for ptr |
---|
[d76c588] | 21 | #include "AST/TypeEnvironment.hpp" // for TypeEnvironment, AssertionSet, OpenVarSet |
---|
| 22 | #include "WidenMode.h" // for WidenMode |
---|
[ea6332d] | 23 | |
---|
[d76c588] | 24 | namespace ast { |
---|
| 25 | class SymbolTable; |
---|
| 26 | class Type; |
---|
| 27 | } |
---|
[51b7345] | 28 | |
---|
| 29 | namespace ResolvExpr { |
---|
[e563edf] | 30 | |
---|
| 31 | bool unify( |
---|
| 32 | const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2, |
---|
| 33 | ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have, |
---|
[251ce80] | 34 | ast::OpenVarSet & open ); |
---|
[e563edf] | 35 | |
---|
| 36 | bool unify( |
---|
| 37 | const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2, |
---|
| 38 | ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have, |
---|
[251ce80] | 39 | ast::OpenVarSet & open, ast::ptr<ast::Type> & common ); |
---|
[e563edf] | 40 | |
---|
| 41 | bool unifyExact( |
---|
| 42 | const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env, |
---|
| 43 | ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open, |
---|
[251ce80] | 44 | WidenMode widen ); |
---|
[e563edf] | 45 | |
---|
| 46 | bool unifyInexact( |
---|
| 47 | const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2, |
---|
| 48 | ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have, |
---|
[251ce80] | 49 | const ast::OpenVarSet & open, WidenMode widen, |
---|
[e563edf] | 50 | ast::ptr<ast::Type> & common ); |
---|
| 51 | |
---|
| 52 | bool typesCompatible( |
---|
[251ce80] | 53 | const ast::Type *, const ast::Type *, |
---|
[e563edf] | 54 | const ast::TypeEnvironment & env = {} ); |
---|
| 55 | |
---|
| 56 | bool typesCompatibleIgnoreQualifiers( |
---|
[251ce80] | 57 | const ast::Type *, const ast::Type *, |
---|
[e563edf] | 58 | const ast::TypeEnvironment & env = {} ); |
---|
[d76c588] | 59 | |
---|
[7b5694d] | 60 | /// Creates or extracts the type represented by returns in a `FunctionType`. |
---|
| 61 | ast::ptr<ast::Type> extractResultType( const ast::FunctionType * func ); |
---|
| 62 | |
---|
| 63 | std::vector<ast::ptr<ast::Type>> flattenList( |
---|
| 64 | const std::vector<ast::ptr<ast::Type>> & src, ast::TypeEnvironment & env |
---|
| 65 | ); |
---|
| 66 | |
---|
[51b7345] | 67 | } // namespace ResolvExpr |
---|
| 68 | |
---|
[a32b204] | 69 | // Local Variables: // |
---|
| 70 | // tab-width: 4 // |
---|
| 71 | // mode: c++ // |
---|
| 72 | // compile-command: "make install" // |
---|
| 73 | // End: // |
---|