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

Fix warning suppressions on types for type hierarchy #2148

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jul 15, 2021

Currently it's not possible to suppress warnings that originate from types in most cases, because we don't process the suppression attributes until after we've processed the type for type hierarchy related warnings.

#2114 changes the library-mode behavior of type hierarchy marking to apply the DAMT annotation when the type with the annotation is first seen. So far we have been reporting an inconsistent warning origin for these (sometimes the GetType call, sometimes the type - see #2136). But by applying the annotations when the type is first marked, we are now reporting warnings from the type, which is introducing some of the additional warnings in dotnet/runtime#55636 that were previously suppressed on the GetType call.

This change makes it possible to suppress the warnings on the originating type. I don't think it's complete since there might be cases where the type is derived from an attribute type and also has attribute instances of that attribute - which would mark the declaring type before processing type hierarchy annotations. But this workaround should be good enough in the meantime, in case we want to use type-level suppressions to unblock runtime dependency flow.

@sbomer sbomer merged commit 9ecf5bd into dotnet:main Jul 15, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
)

* Fix warning suppressions on types for type hierarchy

* Add non-library mode tests

Commit migrated from dotnet/linker@9ecf5bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants