Module scopegraphs::completeness
source · Expand description
This module contains several utilities to guarantee query stability.
Query stability means that the result of a query, once resolved, will remain valid after future additions to the scope graph. This allows safe interleaving of name resolution and scope graph construction.
The main trait of this module is Completeness. An implementation of this trait should be passed
to ScopeGraph::new to obtain a scope graph instance.
Currently, the module contains three safe implementations.
ImplicitCloseis the easiest to use, and most likely the preferred choice for simple sequential type checkers.ExplicitCloserequires some manual bookkeeping, but allows more flexible handling of queries. This is the most suitable choice for type checkers that need to do dynamic scheduling. Running queries can return an error, because scopes relevant to the query weren’t closed yet.FutureCompletenessis likeExplicitClose, except queries can no longer error. Instead, queries return aFuturethat resolves when all scopes related to the query are closed.
Structs§
- Value returned when a query cannot yet be computed because some edge it depends on is still closed.
- Error returned when attempting to add an edge with a label that is already closed in that scope.
- Critical-edge based
Completenessimplementation. - A completeness strategy that makes queries return a
Futurein case one of the scopes that the query runs over was not yet closed. The future resolves once all such scopes are closed. - Critical-edge based
Completenessimplementation. - No-Op implementation of
Completeness.
Traits§
- Types implementing this trait have the responsibility to guarantee query stability.
- Sub-trait of
Completenessthat uses critical edges (scope-label pairs) to manage completeness. // TODO: link to “concepts”
Type Aliases§
- Convenience alias for the type of
Resultreturned from queries using critical edge based completion