-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global variable mapping and preserve primitives (#416)
* If old name is interchangeable, use instead This means that old unions are preserved. However, this doesn't quite explain to me why we get rid of the unnecessary unions. One would expect that we instead get even more unnecessary unions. As of now I can't quite yet explain this change in behaviour, but should be documented once I understand the change in behaviour. * If expr of var declaration empty, ignore Typically an indication that something somewhere else went wrong. However, an extra failsafe isn't too bad, though it does negatively affect coverage if we fix the problem elsewhere of course, though perhaps we're treating the metric with that line of thought. * Fix any_super and is_superset_of in Name * Simplify Expression try_from AST By treating all primitives as their type, we are unable to properly substitute. However, does cause some tests to fail which relied on this behaviour: If expressions, however, no longer appear to be typed. * Split up constraints for if else arms If as a whole is now typed. However, not when used, such as in function body or variable definition. * Also gen then outside if This is to ensure that the constraints are available outside the if. For instance, when we want to substitute the if with the then branch. We don't use the environment, so we shouldn't have any variable contamination. * Constraintbuilder deals with diverging paths We can now create multiple sets which are added to in parallel for diverging paths. The number of active sets is determined by the difference between two internal unsigend numbers. * Remove old constr, prevent contamination We do now have cross contamination with variable names. Are not properly shadowed now. Remove drain filter in ConstrBuilder The method using this was used in a very specific context in with. If not reverted, can now compile with stable rust! * Move variable mapping to constraint builder * Make variable mapping top-level If mapping of new var non-existent, add it to mapping. * Add local variable mapping to environment This takes precedent, meaning that local shadows are used. If not found, then use global. Useful if we have multiple execution paths and later down the line need to perform substitutions. * Fix off-by-one for exit set * Define self when entering class using new system As opposed to creating a new constraint. When accessing self this should be dealt with using the global variable mapping now. * Ignore empty Name in push_ty * Add test for shadowing in script, class, function * Generate constraints for ast without access - Simplify class logic in environment - Add logic for self type in match_id. - Remove logic for adding constraints for any potential field access of self. * Explicitly destroy mapping in Environment * Only define self in functions, not class-level - Ignore type aliases explicitly for now - Remove unnecessary logic in match_id - Do actually shadow self, as self may de defined multiple times in sets inheriting from top-level set. * Use panic to denote bugs in the check stage
- Loading branch information
1 parent
9723d5f
commit 75a5ee1
Showing
40 changed files
with
500 additions
and
448 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
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
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.