-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
[flutter_tools] Fix tool crash for map cast #107648
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
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.
Can you add a test for this change?
@christopherfujino I can, but I'm not sure what I would test. It's clearly a miss from the null-safety migration of this library. I guess because the Please let me know how you'd go about testing this change and I'd be happy to implement it. |
Hmm, that's a good point, this would be difficult to test. I would then suggest following the bot's guidance on requesting a test exemption. |
Wouldn't the test be basically what the code that found the crash in the first place was doing? (@christopherfujino if you think it should be test-exempt I defer to your expertise) |
Thanks for the quick reply, @Hixie. I think that makes sense. Since the issue is in the localization generation code, it is only triggered when running Since this issue will only be triggered in null-safety mode, I've added a separate commit to migrate @christopherfujino Let me know if that all makes sense and if I approached this correctly, or if I need to open a separate PR for the migration. Cheers! |
Hey @christopherfujino, just pinging to get your thoughts. Would love to merge this and/or update as needed. Thanks! |
whoops, sorry I missed this, 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.
LGTM
Hi @Jasguerrero - checking in to see if you think we could merge this? Let me know if you have any concerns. |
testUsingContext('pub get triggers localizations generation when generate: true', () async { | ||
final File pubspecFile = fileSystem.currentDirectory.childFile('pubspec.yaml') | ||
..createSync(); | ||
pubspecFile.writeAsStringSync(''' |
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.
nit on the identation for this and next writeAsStringSync
pubspecFile.writeAsStringSync(
'''
flutter:
generate: true
'''
);
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.
Fixed, thanks! Did you mean for all three or just the first two? Sorry - couldn't follow the heuristic in the latter case if I misunderstood.
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
Fixes a
flutter_tools
crash when generating localizations due to a cast ofjsonDecode
output toMap<String, Object>
in a null-safe library.List which issues are fixed by this PR. You must list at least one issue.
#107647
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
N/A
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.