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

[SR-5942] Swift 4 Migrator handling of ternaries #48501

Open
josephlord opened this issue Sep 20, 2017 · 1 comment
Open

[SR-5942] Swift 4 Migrator handling of ternaries #48501

josephlord opened this issue Sep 20, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. migrator

Comments

@josephlord
Copy link

Previous ID SR-5942
Radar None
Original Reporter @josephlord
Type Bug

Attachment: Download

Environment

Xcode 9 release version. Migrating to minimise inference.

Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Migrator
Assignee None
Priority Medium

md5: 04fdc704cbc442bbb5b67683a60b912f

Issue Description:

The Swift 4 migrator is handling ternary operations that need to be wrapped in a constructor now (and didn't before) quite oddly.

`tableToViewTopConstraint?.priority = isShowingServerUpdating ? 1 : 999`

Should convert to:

`

tableToViewTopConstraint?.priority = UILayoutPriority.RawValue(isShowingServerUpdating ? 1 : 999)

`

But actually converted to:

`tableToViewTopConstraint?.priority = UILayoutPriority(rawValue: UILayoutPriority.RawValue(isShowingServerUpdating ? 1 : 999))`

@belkadan
Copy link
Contributor

The last line is actually correct, if not minimal. If you could omit any of it, it would be the UILayoutPriority.RawValue initializer, which is being used to convert from another integer type. In this case, though, the integers are just literals and so it'd be fine to let them get an inferred type.

@nkcsgexi

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. migrator
Projects
None yet
Development

No branches or pull requests

2 participants