Commit Graph

14 Commits

Author SHA1 Message Date
Pavel Yaskevich
12e9686765 [ConstraintGraph] Remove flags from inference methods
Use newly added `notifyReferencedVars` in `{add, remove}Constraint`.
2021-06-07 14:35:15 -07:00
Pavel Yaskevich
d4cb7564a3 [ConstraintGraph] Extract logic to notify referenced variable into a dedicated method 2021-06-07 14:18:51 -07:00
Pavel Yaskevich
b487b6956b [ConstraintSystem] Delay inference until let's clear that type variable attempt is successful
Currently bindings where inferred on every `bindTypeVariable` call,
but that's wasteful because not all binds are always correct. To
avoid unnecessary inference traffic let's wait until re-activated
constraints are simplified and notify binding inference about new
fixed type only if all of them are successful.
2021-03-01 10:52:29 -08:00
Pavel Yaskevich
166c41d89f [ConstraintGraph] Extract logic related to fixed types into dedicated methods on graph node 2021-03-01 10:52:29 -08:00
Pavel Yaskevich
5c623ebe04 [ConstraintGraph] NFC: Clarify names of inference APIs and add comments 2021-02-24 12:45:21 -08:00
Pavel Yaskevich
1de0764b04 [ConstraintGraph] Make binding inference more incremental and stop resetting bindings 2021-02-24 10:38:31 -08:00
Pavel Yaskevich
fbc11f410a [ConstraintSystem] Implement incremental binding computation 2021-02-24 10:37:20 -08:00
Pavel Yaskevich
9372215012 [ConstraintGraph] Track constraint graph and type variable belonging to the node 2021-02-24 10:25:09 -08:00
Pavel Yaskevich
f9b58a79a3 [ConstraintGraph] NFC: Add a equivalence class truncation callback to graph node
This dedicated method would be useful for upcoming incremental binding
computation.
2021-02-24 10:25:09 -08:00
Pavel Yaskevich
202a9de47c [ConstraintGraph] Start inferring bindings incrementally
Associate potential bindings with a constraint graph node and
start keeping track of added and removed constraints.

This is not a complete implementation because the ability to
infer bindings transitively is missing.
2021-02-24 10:25:09 -08:00
Pavel Yaskevich
8137c7b96a [ConstraintGraph] Split fixed binding storage into referenced by/from
Binding inference requires constraint propagation through to referenced
type variables, in current "fixed bindings" storage mode it is impossible
to figure out whether tracked type variables are referenced by or from
a type variable.

Splitting storage for referenced by/from also helps to provide more
meaningful debug output and make sure there are no attempts to insert
duplicate references.
2021-02-19 12:41:07 -08:00
Pavel Yaskevich
4ef7a2d626 [CSBindings] NFC: Refactor some of the repetitive uses of type variable in graph node 2021-02-16 17:21:44 -08:00
Luciano Almeida
72b594b3fd [NFC][ConstraintGraph] Address fixme and switch CG::Component dependencies type to SmallVector<unsigned> 2020-11-09 19:49:29 -03:00
Pavel Yaskevich
ab951c208a [ConstraintSystem] NFC: Move ConstraintGraph{Scope}.h to include/swift/Sema 2020-10-08 10:42:58 -07:00