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.h --
|
---|
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 <list> // for list
|
---|
19 |
|
---|
20 | #include "AST/Node.hpp" // for ptr
|
---|
21 | #include "AST/TypeEnvironment.hpp" // for TypeEnvironment, AssertionSet, OpenVarSet
|
---|
22 | #include "WidenMode.h" // for WidenMode
|
---|
23 |
|
---|
24 | namespace ast {
|
---|
25 | class SymbolTable;
|
---|
26 | class Type;
|
---|
27 | }
|
---|
28 |
|
---|
29 | namespace ResolvExpr {
|
---|
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,
|
---|
34 | ast::OpenVarSet & open );
|
---|
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,
|
---|
39 | ast::OpenVarSet & open, ast::ptr<ast::Type> & common );
|
---|
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,
|
---|
44 | WidenMode widen );
|
---|
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,
|
---|
49 | const ast::OpenVarSet & open, WidenMode widen,
|
---|
50 | ast::ptr<ast::Type> & common );
|
---|
51 |
|
---|
52 | bool typesCompatible(
|
---|
53 | const ast::Type *, const ast::Type *,
|
---|
54 | const ast::TypeEnvironment & env = {} );
|
---|
55 |
|
---|
56 | bool typesCompatibleIgnoreQualifiers(
|
---|
57 | const ast::Type *, const ast::Type *,
|
---|
58 | const ast::TypeEnvironment & env = {} );
|
---|
59 |
|
---|
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 |
|
---|
67 | } // namespace ResolvExpr
|
---|
68 |
|
---|
69 | // Local Variables: //
|
---|
70 | // tab-width: 4 //
|
---|
71 | // mode: c++ //
|
---|
72 | // compile-command: "make install" //
|
---|
73 | // End: //
|
---|