Commit Graph

74 Commits

Author SHA1 Message Date
Slava Pestov 7cd06a5088 Sema: Split off TypeVariableType.h/.cpp 2026-02-05 09:19:01 -05:00
Pavel Yaskevich fe8a30b119 [CSBindings] PotentialBindings: Track each individual change in the trail
Instead of "catch call" `InferredBindings` that calls `retract` on
`undo`, let's track each mutation of the potential bindings with a
dedicated trail node and undo each individually. This change reduced
the amount of work that `undo` has to make on every scope rollback
and would help helpful for transitive binding inference as well.
2026-01-12 10:36:58 -08:00
Pavel Yaskevich 28e0924108 [CSBindings] PotentialBindings: Track constraint system and type variable association
This is going to help record individual property changes (i.e.
defaults, subtype/supertype/equality etc.) in the solver trail.
2026-01-12 09:21:13 -08:00
Pavel Yaskevich 59c1929529 [CSTrail] Define addition/retraction macros for common binding information
`DelayedBy`, `Protocols`, and `Defaults` all operate on constraints
and so could have templated implementation.
2026-01-09 17:06:07 -08:00
Pavel Yaskevich dd3676a217 [CSTrail] Add a macro that handles binding relation addition 2026-01-09 16:09:34 -08:00
Pavel Yaskevich eda539e0ad [CSTrail] Add a macro that handles binding relation retraction 2026-01-09 15:41:26 -08:00
Pavel Yaskevich 5fd6e5f05c [CSTrail] Add AddedDefault change that tracks addition of default/fallback constraints 2026-01-09 10:58:32 -08:00
Pavel Yaskevich 740e2957cb [CSTrail] Add AddedProtocol change that tracks addition of protocol requirements 2026-01-08 16:51:57 -08:00
Pavel Yaskevich 0bb13c9b5a [CSTrail] Add AddedDelayedBy change that tracks addition of delaying constraints 2026-01-08 16:49:24 -08:00
Pavel Yaskevich 088a77284f [CSTrail] Add AddedLiteral change that tracks addition of literal requirements 2026-01-08 16:35:59 -08:00
Pavel Yaskevich 2da066b76d [CSTrail] Add AddedBinding change which is reverse of RetractedBinding
This is going to be particularily useful for dealing with transitive
bindings because they are identified by the originator.
2026-01-08 16:24:21 -08:00
Pavel Yaskevich 6dece8a817 Merge pull request #86072 from xedin/originator-in-the-binding
[CSBindings] Store the originator type variable in a transitive binding
2025-12-16 09:07:10 -08:00
Pavel Yaskevich 91eefb953e [CSBindings] Store the originator type variable in a transitive binding
Instead of using a flag in `addBinding`, let's record what type variable
does the binding belong to in `PotentialBinding` itself. This is going
to help remove bindings introduced transitively when the inference is
done lazily.
2025-12-15 13:59:36 -08:00
Slava Pestov 77ee3dab7d Sema: Collect LiteralRequirements in PotentialBindings::infer() 2025-12-13 21:16:43 -05:00
Slava Pestov 88f347a000 Sema: Collect defaults in PotentialBindings::infer() 2025-12-13 21:16:43 -05:00
Slava Pestov 01ca51903b Sema: Sink Protocols down from BindingSet into PotentialBindings 2025-12-13 14:50:48 -05:00
Hamish Knight 3141b5a8cd [AST] NFC: Introduce PrintOptions::forDebugging 2025-09-21 23:19:06 +01:00
Anthony Latsis fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
Hamish Knight c69590fbdd [CS] Clean up pack expansion environment handling a little
- Track environments for `PackExpansionExpr` directly
instead of using a locator.
- Split up the querying and creation of the environment
such that the mismatch logic can be done directly in
CSSimplify instead of duplicating it.
- Just store the environment directly instead of
the shape and UUID.
2025-02-20 21:31:46 +00:00
Hamish Knight 0b57ca6d56 [CS] Use dumpAnchor in SolverTrail::Change::dump
Resolve a couple of FIXMEs by using `dumpAnchor` to
dump a couple of ASTNodes. This uses the same
compact representation as used in ConstraintLocator
dumping.
2025-02-20 21:31:46 +00:00
Hamish Knight 29e9f429e3 [CS] NFC: Rename PackEnvironments -> PackElementExpansions
IMO "environment" is confusable for GenericEnvironment,
make it clearer it's referring to the parent
PackExpansionExpr.
2025-02-20 21:31:46 +00:00
Slava Pestov cda3cda132 Sema: Rework change recording in PotentialBindings::retract()
Instead of making an undo() do an infer(), let's record fine-grained
changes about what was retracted, and directly re-insert the same
elements into the data structures.
2025-02-04 20:26:12 -05:00
Pavel Yaskevich f94685e704 [CSTrail] NFC: Add dump() methods to SolverTrail 2024-12-04 10:36:12 -08:00
Pavel Yaskevich f18b772293 [CSTrail] NFC: Make dumpActiveScopeChanges friendlier to humans
`dumpActiveScopeChanges` is used as part of `-debug-constraints`
and could be overwhelming if there are a lot of changes in the scope
because it prints every change including binding inference from
every applicable constraint.

These changes make `dumpActiveScopeChanges` more of summary of
what happened with type variables and constraints so far which
is much easier to navigate while debugging.
2024-12-04 10:36:05 -08:00
Slava Pestov eeab483cab Sema: Undo changes in chronological order in SolverTrail::undo() 2024-11-19 21:24:12 -05:00
Slava Pestov a40d4c79ea Sema: Fix access of wrong union member 2024-10-24 18:17:52 -04:00
Slava Pestov 58a6a64647 Sema: SolverTrail::Change::RetiredConstraint now remembers the position 2024-10-21 17:19:01 -04:00
Slava Pestov bdab82a192 Sema: Use xmacros to clean up more duplication in CSTrail.{cpp,h} 2024-10-08 16:50:49 -04:00
Slava Pestov 5fdc1a81b8 Sema: Record retired constraints in the trail 2024-10-08 16:39:34 -04:00
Slava Pestov 90175400d2 Sema: Record generated constraints in the trail 2024-10-08 16:17:28 -04:00
Slava Pestov 1e2d4fbc59 Sema: Record score increases in the trail 2024-10-08 16:16:31 -04:00
Slava Pestov f2412f318e Sema: Record key path expressions in the trail 2024-10-07 16:50:48 -04:00
Slava Pestov 881a0100b2 Sema: Record implicit value conversions in the trail 2024-10-07 16:50:48 -04:00
Slava Pestov ac17292dfe Sema: Record preconcurrency closures in the trail 2024-10-07 16:50:48 -04:00
Slava Pestov b961a7ec51 Sema: Record isolated parameters in the trail 2024-10-07 16:50:48 -04:00
Slava Pestov 1d177d0187 Sema: Record expression patterns in the trail 2024-10-07 16:50:48 -04:00
Slava Pestov 500acd122a Sema: Record potential throw sites in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 39d0eab275 Sema: Record case label items in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 8c8a385a4a Sema: Record SyntacticElementTargetKeys in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 516277f0fd Sema: Record contextual types in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 666361adf2 Sema: Record implied results in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 1d18cd07cf Sema: Record closure types in the trail 2024-10-07 16:50:47 -04:00
Slava Pestov 43a4ac9216 Sema: Record resolved overloads in the trail 2024-10-07 16:50:46 -04:00
Slava Pestov 892e79cd70 Sema: Use an xmacro to clean up some duplication in CSTrail.cpp 2024-10-07 16:50:46 -04:00
Slava Pestov 9201a37519 Sema: Strenghten invariants in SolverTrail::Change::undo() 2024-10-07 16:50:46 -04:00
Slava Pestov 6862955244 Sema: Record applied property wrappers in the trail 2024-10-07 16:50:46 -04:00
Slava Pestov c7edc3494e Sema: Record result builder transforms in the trail 2024-10-07 16:50:45 -04:00
Slava Pestov 9115a46736 Sema: Record favored constraints in the trail 2024-10-07 16:50:45 -04:00
Slava Pestov b2adf51d78 Sema: Record disabled constraints in the trail 2024-10-07 16:50:45 -04:00
Slava Pestov 411c590bc8 Sema: Record key path component types in the trail 2024-10-07 16:50:44 -04:00