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

Add a test for warning behavior of Requires on type with a const field #84452

Merged

Conversation

vitek-karas
Copy link
Member

The IL tools (illink, ilc) don't see const field references in code, since the compiler inlines the values. But analyzer does see them. If the const field is on a type with Requires attribute, that access is reported as a warning, which is only produced by the analyzer.

This adds tests for these cases, no product changes.

Tests for #84433

The IL tools (illink, ilc) don't see const field references in code, since the compiler inlines the values. But analyzer does see them. If the const field is on a type with Requires attribute, that access is reported as a warning, which is only produced by the analyzer.

This adds tests for these cases, no product changes.

Tests for dotnet#84433
@vitek-karas vitek-karas added test-enhancement Improvements of test source code area-Tools-ILLink .NET linker development as well as trimming analyzers labels Apr 6, 2023
@vitek-karas vitek-karas requested a review from sbomer April 6, 2023 22:31
@vitek-karas vitek-karas self-assigned this Apr 6, 2023
@ghost ghost added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 6, 2023
@ghost
Copy link

ghost commented Apr 6, 2023

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Issue Details

The IL tools (illink, ilc) don't see const field references in code, since the compiler inlines the values. But analyzer does see them. If the const field is on a type with Requires attribute, that access is reported as a warning, which is only produced by the analyzer.

This adds tests for these cases, no product changes.

Tests for #84433

Author: vitek-karas
Assignees: vitek-karas
Labels:

test-enhancement, area-Tools-ILLink

Milestone: -

@vitek-karas
Copy link
Member Author

CI failures are:
#84368
#80619
#83551

@vitek-karas vitek-karas merged commit 0760f77 into dotnet:main Apr 7, 2023
@vitek-karas vitek-karas deleted the RequiresOnTypeWithConstFieldTest branch April 7, 2023 15:57
@ghost ghost locked as resolved and limited conversation to collaborators May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework test-enhancement Improvements of test source code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants