#include <stdint.h>#include <stdlib.h>#include <iostream>#include <string>#include <sstream>#include <libsherpa/UExcept.hxx>#include <libsherpa/CVector.hxx>#include <assert.h>#include "UocInfo.hxx"#include "Options.hxx"#include "AST.hxx"#include "Type.hxx"#include "TypeScheme.hxx"#include "Typeclass.hxx"#include "inter-pass.hxx"#include <libsherpa/BigNum.hxx>#include "TypeInfer.hxx"#include "TypeEqInfer.hxx"#include "TypeInferCommon.hxx"Go to the source code of this file.
Defines | |
| #define | TYPEEQINFER(ast, gamma, instEnv, impTypes, isVP, tcc, uflags, trail, mode, flags) |
| #define | PRINT(out, ast, ct) |
Functions | |
| std::string | ctypeAsString (GCPtr< Type > t, GCPtr< Constraints > cset, bool showAllCts=false) |
| static GCPtr< Type > | buildFnFromApp (GCPtr< AST > ast, unsigned long uflags) |
| static GCPtr< TypeScheme > | bindIdentDef (GCPtr< AST > ast, GCPtr< Environment< TypeScheme > > gamma, unsigned long bindFlags, unsigned long flags) |
| static GCPtr< TypeScheme > | Instantiate (GCPtr< AST > ast, GCPtr< TypeScheme > sigma) |
| void | addSubCst (GCPtr< AST > errAst, GCPtr< Type > t1, GCPtr< Type > t2, GCPtr< Constraints > tcc) |
| void | addEqCst (GCPtr< AST > errAst, GCPtr< Type > t1, GCPtr< Type > t2, GCPtr< Constraints > tcc) |
| void | addCcCst (GCPtr< AST > errAst, GCPtr< Type > t1, GCPtr< Type > t2, GCPtr< Constraints > tcc) |
| void | addPcst (GCPtr< AST > errAst, GCPtr< Type > t, GCPtr< Constraints > tcc) |
| bool | typeEqInfer (std::ostream &errStream, GCPtr< AST > ast, GCPtr< Environment< TypeScheme > > gamma, GCPtr< Environment< CVector< GCPtr< Instance > > > > instEnv, GCPtr< CVector< GCPtr< Type > > >impTypes, bool isVP, GCPtr< Constraints > tcc, unsigned long uflags, GCPtr< Trail > trail, int mode, unsigned flags) |
| #define PRINT | ( | out, | |||
| ast, | |||||
| ct | ) |
Value:
do { \ out << "[" << ast->atKwd() << "]" \ << ast->asString() << " : " \ << ctypeAsString(ast->symType, ct, true) \ << std::endl; \ } while(0)
Definition at line 69 of file TypeEqInfer.cxx.
Referenced by typeEqInfer().
| #define TYPEEQINFER | ( | ast, | |||
| gamma, | |||||
| instEnv, | |||||
| impTypes, | |||||
| isVP, | |||||
| tcc, | |||||
| uflags, | |||||
| trail, | |||||
| mode, | |||||
| flags | ) |
Value:
do { \ CHKERR((errFree), \ (typeEqInfer(errStream, (ast), (gamma), (instEnv), \ (impTypes), (isVP), (tcc), (uflags), \ (trail), (mode), (flags)))); \ }while(0)
Definition at line 61 of file TypeEqInfer.cxx.
Referenced by typeEqInfer().
| void addCcCst | ( | GCPtr< AST > | errAst, | |
| GCPtr< Type > | t1, | |||
| GCPtr< Type > | t2, | |||
| GCPtr< Constraints > | tcc | |||
| ) |
Definition at line 172 of file TypeEqInfer.cxx.
References addSubCst().
Referenced by typeEqInfer().
| void addEqCst | ( | GCPtr< AST > | errAst, | |
| GCPtr< Type > | t1, | |||
| GCPtr< Type > | t2, | |||
| GCPtr< Constraints > | tcc | |||
| ) |
Definition at line 164 of file TypeEqInfer.cxx.
References addSubCst().
Referenced by EqUnify(), and typeEqInfer().
| void addPcst | ( | GCPtr< AST > | errAst, | |
| GCPtr< Type > | t, | |||
| GCPtr< Constraints > | tcc | |||
| ) |
| void addSubCst | ( | GCPtr< AST > | errAst, | |
| GCPtr< Type > | t1, | |||
| GCPtr< Type > | t2, | |||
| GCPtr< Constraints > | tcc | |||
| ) |
Definition at line 155 of file TypeEqInfer.cxx.
References sub().
Referenced by addCcCst(), addEqCst(), EqUnify(), TransClose(), and typeEqInfer().
| static GCPtr<TypeScheme> bindIdentDef | ( | GCPtr< AST > | ast, | |
| GCPtr< Environment< TypeScheme > > | gamma, | |||
| unsigned long | bindFlags, | |||
| unsigned long | flags | |||
| ) | [static] |
Definition at line 109 of file TypeEqInfer.cxx.
References assert(), BF_NO_MERGE, ID_IS_MUTATED, and TI_TYP_EXP.
Referenced by resolve(), typeEqInfer(), and typeInfer().
Definition at line 90 of file TypeEqInfer.cxx.
References assert(), and at_apply.
Referenced by typeEqInfer(), and typeInfer().
| std::string ctypeAsString | ( | GCPtr< Type > | t, | |
| GCPtr< Constraints > | cset, | |||
| bool | showAllCts = false | |||
| ) |
| static GCPtr<TypeScheme> Instantiate | ( | GCPtr< AST > | ast, | |
| GCPtr< TypeScheme > | sigma | |||
| ) | [static] |
| bool typeEqInfer | ( | std::ostream & | errStream, | |
| GCPtr< AST > | ast, | |||
| GCPtr< Environment< TypeScheme > > | gamma, | |||
| GCPtr< Environment< CVector< GCPtr< Instance > > > > | instEnv, | |||
| GCPtr< CVector< GCPtr< Type > > > | impTypes, | |||
| bool | isVP, | |||
| GCPtr< Constraints > | tcc, | |||
| unsigned long | uflags, | |||
| GCPtr< Trail > | trail, | |||
| int | mode, | |||
| unsigned | flags | |||
| ) |
Definition at line 198 of file TypeEqInfer.cxx.
References addCcCst(), addEqCst(), addPcst(), addSubCst(), argVec, assert(), at_apply, at_argVec, at_boolLiteral, at_charLiteral, at_constraints, at_define, at_deref, at_dummyType, at_dup, at_exceptionType, at_floatLiteral, at_fn, at_fnargVec, at_ident, at_identPattern, at_if, at_interface, at_intLiteral, at_lambda, at_module, at_mutableType, at_primaryType, at_select, at_setbang, at_stringLiteral, at_struct_apply, at_ucon_apply, at_unit, BF_REBIND, bindIdentDef(), buildFnFromApp(), COMP_BYREF, ctr, ctypeAsString(), DEF_MODE, EqUnify(), Instantiate(), PRINT, TI_TCC_SUB, TI_TYP_APP, TI_TYP_EXP, TY_CT_SUBSUMED, TYPEEQINFER, and USE_MODE.
1.4.7