Skip to content

Foundation: explicitly convert value to Date #2885

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

Closed
wants to merge 1 commit into from

Conversation

compnerd
Copy link
Member

There is no implicit conversion from Int to Date. The implicit cast
fails, resulting in nil being returned for the creationDate
property. Explicitly unwrap the result of the .creationDate attribute
and use that to construct the Date to return.

Partially addresses: SR-13617

There is no implicit conversion from `Int` to `Date`.  The implicit cast
fails, resulting in `nil` being returned for the `creationDate`
property.  Explicitly unwrap the result of the `.creationDate` attribute
and use that to construct the `Date` to return.

Partially addresses: SR-13617
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

CC: @spevans @millenomi

get {
guard let timestamp: Int = _get(.creationDateKey) else { return nil }
return Date(timeIntervalSince1970: TimeInterval(timestamp))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, set doesn't have the corresponding issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats actually why Im not 100% certain why this is needed. There are other Date accessors which should also see similar things? The test suite seems to be passing though, so Im not sure what is special here.

@compnerd
Copy link
Member Author

compnerd commented Sep 28, 2020

Okay, with the help from @millenomi this is no longer necessary (#2884 is the complete fix)

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