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

Consider extension receiver conversion when reducing #73762

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented May 29, 2024

Test plan: #73445

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels May 29, 2024
var d1Access = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>()
.First(s => s.Expression.ToString() == "a");
var lookupResult = model.LookupSymbols(d1Access.Name.SpanStart, aSymbol.Type, "M", includeReducedExtensionMethods: true);
AssertEx.Equal("System.Int32 System.Span<System.Int32>.M(System.Int32 y)", lookupResult.Single().ToTestDisplayString());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the product change

  • the error messages would be that the extension method is not applicable (CS1929) rather than that Span cannot be a delegate receiver (CS1113) - but that's just different diagnostics, so probably not very interesting
  • however also this LookupSymbols would not be able to find the method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it looks like we'll report "error CS8917: The delegate type could not be inferred" rather than "error CS1113: Extension method ... cannot be used to create delegates" if the ReducedExtensionMethodSymbol change is removed.

@jjonescz jjonescz requested review from 333fred and cston May 29, 2024 12:42
@jjonescz jjonescz marked this pull request as ready for review May 29, 2024 12:42
@jjonescz jjonescz requested a review from a team as a code owner May 29, 2024 12:42
@jjonescz jjonescz changed the base branch from dev/jjonescz/FirstClassSpan-02 to features/FirstClassSpan June 13, 2024 12:21
@jjonescz jjonescz requested a review from a team as a code owner June 13, 2024 12:21
@jjonescz jjonescz force-pushed the FirstClassSpan-04-ReducedExtensionMethod branch from f8a481c to 2ff45e6 Compare June 13, 2024 12:23
@jjonescz jjonescz merged commit 10691c9 into dotnet:features/FirstClassSpan Jun 14, 2024
24 checks passed
@jjonescz jjonescz deleted the FirstClassSpan-04-ReducedExtensionMethod branch June 14, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - First-class Span Types 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.

3 participants