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

Allow only ordinary member method calls to be intercepted #70120

Merged

Conversation

RikkiGibson
Copy link
Contributor

@RikkiGibson RikkiGibson commented Sep 25, 2023

Closes #70061

Spec says:

Interception can only occur for calls to ordinary member methods--not constructors, delegates, properties, local functions, operators, etc. Support for more member kinds may be added in the future.

Looks like this wasn't thoroughly tested/the behaviors we expected in tests weren't in line with spec.

The interesting cases to test here are when we have an invocation in syntax but it's not invoking a member method, e.g. delegate, local function, and function pointer cases. I wasn't able to think of any others which are like that.

I tried to write a general purpose assertion for bound nodes which are associated with call syntax, to ensure we've always accounted for the possibility of the user trying to intercept the call in syntax. But the assertion I came up with ended up hitting too many cases for me to want to pursue adding it in this PR.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 25, 2023
@RikkiGibson RikkiGibson changed the base branch from main to release/dev17.8 September 26, 2023 21:18
@RikkiGibson RikkiGibson marked this pull request as ready for review September 26, 2023 23:28
@RikkiGibson RikkiGibson requested review from a team as code owners September 26, 2023 23:28
@RikkiGibson RikkiGibson requested a review from a team September 27, 2023 17:35
@RikkiGibson RikkiGibson merged commit 1545811 into dotnet:release/dev17.8 Sep 27, 2023
@RikkiGibson RikkiGibson deleted the interceptors-disallow-delegates branch September 27, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calls with nullable warning suppressions cannot be intercepted
3 participants