-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Use template where clause to avoid a runtime type test. #14
base: master
Are you sure you want to change the base?
Conversation
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.
Hooray generics!
If you login and click on your profile it'll load a So it goes in the generic initializer and fail to decode the list. Maybe something else is missing? |
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.
Doesn't work
…s and add unit test for changed model
Are you sure my PR is causing the issue you are seeing? I just forked and built https://github.com/Dimillian/RedditOS on Xcoder 12.3 / MacOS 11.2 beta without my pull request, and when I sign in and click on a profile page, I get this infinite spinner: _ |
Hi Thomas,
Here's what I meant by my tweet saying that I didn't think you needed the runtime type check. The "where" clause turns it into a compile-time type check.
I wasn't able to test this. It builds, but it doesn't look like there's any code in the current project that uses the code that changed, so I don't know if it works or not.
It seems to me that it should work, though. And the assert will at least provide runtime evidence if it's incorrect.