Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injected binders should be resilient to GetBinder calls #75437

Open
jcouv opened this issue Oct 8, 2024 · 0 comments
Open

Injected binders should be resilient to GetBinder calls #75437

jcouv opened this issue Oct 8, 2024 · 0 comments
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Oct 8, 2024

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:

  1. avoid injecting the binder on-the-fly (use a binder factory instead)
  2. ensure that GetBinder maintains the injected binder

FYI @AlekseyTs

@jcouv jcouv added Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality labels Oct 8, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 8, 2024
@jaredpar jaredpar added this to the Backlog milestone Oct 9, 2024
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Projects
None yet
Development

No branches or pull requests

2 participants