-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: polymorphic function types (inc OpDefs) using dyn trait (#630)
* Add type variable as a variant of PrimType and TypeArg * Add types/poly_func.rs containing PolyFuncType - a list of binders ('TypeParam's) and a FunctionType * can be instantiated to a FunctionType, or (perhaps-partially) a PolyFuncType * PrimType contains PolyFuncType, not FunctionType * Add `substitute` method to Type, TypeArg, et al., taking a Substitution trait which provides values for type variables * Implementations SubstValues (when instantiating) as well as InsideBinders and Renumber for dealing with PolyFuncTypes * OpDefs may have either binary compute_signature functions or PolyFuncType "type schemes"; the former (i.e. binary functions) return the latter. * Add LeafOp::TypeApply whose signature represents applying a PolyFuncType to a type-argument - the argument of kind (i.e. TypeParam) depending on the former BREAKING CHANGE: * Rename OpDef::instantiate_concrete to just instantiate; * PrimType::Function and Type::new_function take PolyFuncType not FunctionType --------- Co-authored-by: Seyon Sivarajah <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,292 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.