-
Notifications
You must be signed in to change notification settings - Fork 147
Apply fallback availability logic to beta information #910
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
Apply fallback availability logic to beta information #910
Conversation
464b9cc
to
69b4dd4
Compare
DefaultAvailability.fallbackPlatforms.forEach { fallbackPlatform in | ||
if (!currentPlatforms.keys.contains(fallbackPlatform.key.displayName)) { | ||
currentPlatforms[fallbackPlatform.key.displayName] = currentPlatforms[fallbackPlatform.value.rawValue] | ||
} | ||
} |
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.
Is there a reason why displayName
is used on the key but rawValue
is used on the value (both are PlatformName
elements)?
Also, this can be written simpler using a regular for loop that binds the key and values to separate meaningful names. If you want you can also move the if statement into a where clause on the loop
DefaultAvailability.fallbackPlatforms.forEach { fallbackPlatform in | |
if (!currentPlatforms.keys.contains(fallbackPlatform.key.displayName)) { | |
currentPlatforms[fallbackPlatform.key.displayName] = currentPlatforms[fallbackPlatform.value.rawValue] | |
} | |
} | |
for (platform, fallbackPlatform) in DefaultAvailability.fallbackPlatforms where currentPlatforms[platform.displayName] == nil { | |
currentPlatforms[platform.displayName] = currentPlatforms[fallbackPlatform.rawValue] | |
} |
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.
For clarification, there are two pieces to my comment above:
- A question if there's a potential bug with using
.displayName
for one of the platforms and.rawValue
for the other - A non-blocking style suggestions about using a regular loop and using contextually relevant variable names instead of "key" and "value".
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.
I don't remember if the initial choice of using rawValue
instead of displayName
was intentional, but I don't think it makes a difference since in practice both will be the same (iOS
).
However, after reviewing it, I decided to change it to displayName
since it has the raw value as fallback and looks more consistent with the rest of the code.
self.displayName = displayName ?? rawValue
I updated the commit with the changes.
For platforms that have a fallback platform, copy the platform availability information passed through the CLI, including the `isBeta` value. rdar://127227456
69b4dd4
to
14d27a1
Compare
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.
LGTM
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.
Looks good to me
@swift-ci please test |
…er. (swiftlang#910) For platforms that have a fallback platform, copy the platform availability information passed through the CLI, including the `isBeta` value. rdar://127227456
Bug/issue #, if applicable: 127227456
Summary
Apply fallback availability logic to beta information.
For platforms that have a fallback platform, copy the availability information passed through the CLI, including the
isBeta
value.The fallback platform logic works correctly for availability information passed through the SGFs but does not apply to availability information passed through the --platform CLI option. This inconsistency caused unexpected behavior. For instance, a symbol would copy the version from iOS, which is also marked as beta, and display it as available for both iOS and iPadOS, but only as beta for iOS.
This PR aims to fix this by also adding the same fallback mechanism to the information about the current release of a platform passed through the CLI.
Dependencies
N/A.
Testing
Steps:
iPadOS
andCatalyst
are marked as betaAvailability.docc.zip
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded`