dotnet / linker

387 stars 126 forks source link

Fix a small bug in message origin for warnings from static field access on generic type #3186

Closed vitek-karas closed 1 year ago

vitek-karas commented 1 year ago

The warning needs to be generated from the origin where the field reference comes from - so if it's a method body, then from the method body. This is because the instantiation is determined by that place, not the field itself (the field is defined on an open generic definition of the type).

This syncs the relevants tests with a NativeAOT work-in-progress change, but in generately it adds a lot more cases and some better comments.