-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Any time a binder is created/injected on-the-fly during binding, there is a risk that it could get dropped when it is used to bind an expression that involves getting more specific binders with GetBinder.
Using LocalInProgressBinder as an example (issue fixed in #75371):
This binder was injected when binding a local initializer to compute its constant value (new LocalInProgressBinder(...) in SourceLocalSymbol.MakeConstantTuple).
The binder keeps track of the const local being bound and helps avoid circularity issues.
But binding some expressions like checked(x) or x switch { ... } would involve a call to GetBinder and the LocalInProgressBinder would be lost, opening the compiler up to circularity issues.
Two possible solutions we discussed so far:
- avoid injecting the binder on-the-fly (use a binder factory instead)
- ensure that
GetBindermaintains the injected binder
FYI @AlekseyTs