Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Aug 13, 2021

#2191 addressed issues with redundant
warnings from base types, but interfaces need to be handled specially.

There were a few issues with the interface handling in that change:

  • The binding logic didn't include interfaces for DAM.All when
    declaredOnly was specified, as @vitek-karas pointed out in
    Use DAM binder for MarkEntireType #2206 (comment).
    This could have led to us not marking interfaces for types derived
    from a DAMT.All-annotated type. Either way, the binding logic
    should not select interface members when declaredOnly is specified.
  • The DAMT-on-type logic had special handling for base types, but
    didn't separately mark interface members, which is needed when
    applying annotations DAMT.All or DAMT.Interfaces. This could have led
    to missing interface impls or interface members for types which have
    (explicit or inherited) DAMT.All or DAMT.Interfaces annotations.

Separately, the bit operations on DAMT also didn't correctly handle cases
where there are bits shared by different enum members.

dotnet#2191 addressed issues with redundant
warnings from base types, but interfaces need to be handled specially.

There were a few issues with the interface handling in that change:
- The binding logic didn't include interfaces for DAM.All when
  declaredOnly was specified, as @vitek-karas pointed out in
   dotnet#2206 (comment).
   This could have led to us not marking interfaces for types derived
   from a DAMT.All-annotated type. Either way, the binding logic
   should not select interface _members_ when declaredOnly is specified.
- The DAMT-on-type logic had special handling for base types, but
  didn't separately mark interface members, which is needed when
  applying annotations DAMT.All or DAMT.Interfaces. This could have led
  to missing interface impls or interface members for types which have
  (explicit or inherited) DAMT.All or DAMT.Interfaces annotations.

Separately, the bit operations on DAMT also didn't correctly handle cases
where there are bits shared by different enum members.
Comment on lines +246 to +247
// This may produce redundant warnings when the annotation is DAMT.All or DAMT.PublicConstructors and the base already has a
// subset of those annotations.
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunate, but I would not worry about it for now...

@sbomer sbomer merged commit c321df2 into dotnet:main Aug 13, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
* Fix warnings for DAMT on interfaces

dotnet/linker#2191 addressed issues with redundant
warnings from base types, but interfaces need to be handled specially.

There were a few issues with the interface handling in that change:
- The binding logic didn't include interfaces for DAM.All when
  declaredOnly was specified, as @vitek-karas pointed out in
   dotnet/linker#2206 (comment).
   This could have led to us not marking interfaces for types derived
   from a DAMT.All-annotated type. Either way, the binding logic
   should not select interface _members_ when declaredOnly is specified.
- The DAMT-on-type logic had special handling for base types, but
  didn't separately mark interface members, which is needed when
  applying annotations DAMT.All or DAMT.Interfaces. This could have led
  to missing interface impls or interface members for types which have
  (explicit or inherited) DAMT.All or DAMT.Interfaces annotations.

Separately, the bit operations on DAMT also didn't correctly handle cases
where there are bits shared by different enum members.

* Remove debug output

* Apply suggestions from code review

Co-authored-by: Vitek Karas <[email protected]>

Co-authored-by: Vitek Karas <[email protected]>

Commit migrated from dotnet/linker@c321df2
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