-
Notifications
You must be signed in to change notification settings - Fork 189
AUTOMAP #2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
athas
wants to merge
359
commits into
master
Choose a base branch
from
automap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
AUTOMAP all the way!
* A few tests * More unit tests * Remove dead code * New function for tests that should fail * Better version of 'testSolveFail' * Extra import * Function for making type params * New tests * Space between test cases * Rename test case * Extra occurs check test * Few more tests * Explicit import * Rename 'sub' function to 'normalize' * Clear everything * Add Union-Find data structure * Refactor * Add new version of TySolve * Return to original implementation (for now) * Import Control.Monad.ST * Fix comments * Add todo * Add import * Update todo * Refactor most of UnionFind module * Refactor SolveM and implement initialState * Explicit imports * Clarify comment * Add skeleton for new implementation * Always assign second argument node's key to result of union * Make some things more readable * Debug prints * Clarify comment * More information in debug prints * Add regex support * Use regexes on expected error messages * Minor cleanup * Add function for making type variables with constraints * Explicitly import '=~' for regexes * Add possible new representation of type variables * Add 'level' field to ReprInfo * Update union function to track minimum level in ReprInfo - It might be better to handle the level logic in TySolve but we'll have it like this for now * Renaming * Add 'lvl' as argument to 'makeTyVarNode' * Clarify comment * Improve debug output in subTyVar by listing type variables in trace message * Remove 'level' (for now) * Remove debug prints * Refactor 'union' to correctly handle which key new root gets * Implement 'unionTyVars' (with helper functions) * Use '$' instead * Rename 'assignType' to 'assignNewSol' * occursCheck working? * Implement 'solveEq' * subTyVar implemented? * Remove redundant functions * Rename variable * Remove unused Unifier type definition * Implement 'solve' * Add scope and liftedness checks * Fix some stuff * Use new implementation of TySolve for tests * Outcomment most tests for now * Minor fix * Add 'isRepr' function * Comment out unused function * Readd all tests * Minor fixes in 'solve' * Fix 'solution' * Fix 'scopeCheck' * Remove 'traceM' import * Mini refactor * Utilize that 'solution' still has access to the state * Style fix * Avoid converting to and from list * Use state instead of function parameter * Fix when type variable is linked to other type variable * Add test case * Remove old pattern * Fix indentation * Rename `tv` to `tvFree` * Remove unused function * Add functions for creating different types of flexible type variables * Rename variable * Traverse map instead of converting to and from list * Use state instead of formal parameter * Missing space * Rename `initialState` to `initializeState` * Add todo * Use our implementation of 'substTyVars' * Optimize 'solution' function * Remove redundant function * Change variable name * Obey line length limit here * Rename this function to clarify that it returns a tyvar's solution * Split 'mkSubst's type signature into multiple lines * Refactor duplicated code into function * Remove a line * Replace 'enrichType' with 'substTyVars' * Avoid redundant lookup * Small refactor * Add clarifying comment * Move this down * Clarify this comment * Remove this comment * Use function composition here * Use function composition here * Use these "specialized" functions instead * Rename variables for improved readability * Add todo * Mini refactor * Rename these for clarity * Fix todo * Add short documentation for `getKey` * Remove redundant function * Use '@' instead * Fix bug in `solveEq` * Add tests for record with polymorphic fields and opaque type handling * Add tests for propagation of liftedness * Add extra test that should result in a scope violation * Add logging possibility to new implementation * Consistency fix * Add '|' to make documentation visble when hovering over function names * Temporary fix of occurs check bug * New way of doing occurs check - Not sure if this is a complete fix but all tests still pass * Add todo * Add todo * Try to provide somewhat more useful error information * Add new tests for occurs check * Format for better readability * Small optimization of `occursCheck` * Remove outcommented code * Overwrite old type constraint solver with new implementation - Refactored the `UnionFind` module to include a new function `getLvl` for retrieving the level of a type variable node. - Updated the `union` function in `UnionFind` to properly handle the level of type variables during union operations. * Avoid normalizing in here, too * Rewrite `TyVarFree` case in `solveTyVar` * Remove comment * Remove todo * Remove dead code * Change the expected result - This is equivalent to the former substitution so it is still a correct solution * Change test case names * Fix bug when doing scope check * Minor change in type signature * Temporary fix of scope check * scopeCheck in solveTyVar to pass level1.fut test * Add benchmarking script * Remove dead code * Remove more dead code * Remove redundant function * Remove redundant import * Remove strict unpacking for solution and key fields * Refactor path compression logic in `find` * Update path compression logic (again) * Rename `solution` to `getSolution` * Refactor path compression logic in `find` * Substitute with the root type variable when original type variable isn't solved * Benchmarking * Refactor `SolveM` - Changed the stack order to improve performance - Changed from using `StateT` to `ReaderT` to make it more clear that we don't alter the map from type variables to their nodes * Add benchmarking script for Futhark performance comparison * Unnecessary * Fix comments * Remove information about `level`s inside representatives * Remove this * Remove to-do's * Benchs now include cases with less than 30 cons * Remove unused import * Add hash tables * Add extra check in `find` * Disable union-by-weight * Remove hash table imports * Use `$` instead * Flatten the node structure - `Repr` is no contained in a reference * Remove weight from information about representative * A little more clean * Remove strictness annotations * Remove `hashtables` dependency * Refactor `bindTyVar` to accept a node as a parameter * Refactor `solveEq` - Possibly return a node from `flexible` to avoid multiple lookups - Rename `sub` to `normalize` - Make `solveCt'` more readable in general * Refactor `lookupTyVar` to accept a `TyVarNode` * Refactor `unionTyVars` to accept `TyVarNode` parameters * Remove redundant check in `TyVarPrim` case in `solveTyVar` * Refactor `getSolution` - Resolve every type variable's type first, then find unconstrained and solutions * Use non-strict version of `foldrWithKey` - Performance is more or less the same so no need to introduce strictness * Consistency * 'union' is probably a better word here * Refactor `flexible` function to simplify return type and improve readability in `solveEq` * Add comment * Refactor `scopeCheck` * Simplify these cases to only update liftedness when necessary * Flip branches in if-statement * Split type annotation into multiple lines * Add clarifying comment * Move this comment * Add clarifying error message (just in case) * Change variable name from `n` to `node` * Change name of this variable * Split this type annotation into multiple lines * Split this case into multiple lines * Split this type annotation into multiple lines * Switch order of cases in `solveTyVar` to reflect order in `TyVarInfo` definition * Remove this colon * Remove profiling option * Remove redundant `do` * Rename `LinkInfo` to `NodeInfo` * Change variable names for clarity * Refactor `NodeInfo` structure - `ReprInfo` helps make operations more type safe - Strict fields help improve performance * Turn `get` functions into one-liners * Clarify `find` documentation * Clearer and more consistent naming of variables * A tiny bit more readable * Add `unionNewSol` function to explicitly pass new solution as argument * Refactor `unionTyVars` - Checking if unification is possible before joining equivalence classes - Using `unionNewSol` to explicitly choose new solution of resulting equivalence class * Put this on the same line * Clarify comment * Style fixes. * Fix futhark-benchmarks submodule * Remove generated type solver benchmarks. They are much too large and many of them fail. The idea is good, so maybe we can bring them back in a more controlled way someday. * Style fixes. * Fewer of these. * Restore a real benchmark. * Better grouping. * Reformat. --------- Co-authored-by: Laust K. Dengsøe <[email protected]> Co-authored-by: Laust Kjæp Dengsøe <[email protected]> Co-authored-by: Troels Henriksen <[email protected]>
I'm not sure when we will be able to finish AUTOMAP, but the new type checker should be doable. AUTOMAP can then be built on top of this.
This reverts commit 5ff3c67.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.