-
Notifications
You must be signed in to change notification settings - Fork 548
[generator] Fix property accessor attributes when one accessor's iOS availability is different than the property itself. #17298
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
873eff7 to
c9ace05
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…availability is different than the property itself. In the following scenario: * A property is available on iOS (and implicitly Mac Catalyst). * One of the property accessors is not available on iOS, but still available on Mac Catalyst (explicitly). We'd generate the wrong availability attributes for ... As for the fix: I can't really explain it. This code is rather impenetrable, and the parameter names don't make much sense, but whatever I did seems to work? And it turns out this fix shows up in an existing test as well (the generator's Bug35176 test), which I had to modify to remove the expectation of (redundant) availability attributes that we no longer produce.
… the property itself. Scenario: * Type is available on iOS, tvOS. * Property in the type is available on iOS (and not tvOS). * Property accessor has explicit availability attributes for iOS. Then the property accessor would get the availability attribute for tvOS from the type, and not the (un)availability attribute from the property. The fix is to make sure the parent context is the property (and not the type) when processing availability attributes for the accessor.
967737f to
be7e8f5
Compare
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) Unable to create gist: Response status code does not indicate success: 502 (Bad Gateway). (raw diff) - Please review changes) Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: simulator tests. 🎉 All 225 tests passed 🎉 Tests counts✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
dalexsoto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests give more confidence about the change 👍
This PR handles two scenarios (fixed in separate commits):
Scenario 1:
We'd generate the wrong availability attributes for the property accessors,
because we'd take the type's availability attributes and add them to the
accessors.
As for the fix: I can't really explain it. This code is rather impenetrable,
and the parameter names don't make much sense, but whatever I did seems to
work?
And it turns out this fix shows up in an existing test as well (the
generator's Bug35176 test), which I had to modify to remove the expectation of
(now redundant) availability attributes that we no longer produce.
Scenario 2:
Then the property accessor would get the availability attribute for tvOS from the
type, and not the (un)availability attribute from the property.
The fix is to make sure the parent context is the property (and not the type) when
processing availability attributes for the accessor.