Skip to content

Conversation

@asashour
Copy link
Contributor

#121318

This PR modifies the code in order not to trigger the incoming diagnostic.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 23, 2023
&& event.extensionRPC == extensionName) {
isolateEvents.cancel();
extensionAdded.complete(event.isolate);
extensionAdded.complete(event.isolate!);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add && event.isolate != null to the if comparison on lines 935-936?

Copy link
Contributor

Choose a reason for hiding this comment

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

or, maybe another conditional here? i'm not sure what to do here, but also not confident we won't hit a null check error here. @bkonyi WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should never be null for a ServiceExtensionAdded event.

Copy link
Contributor Author

@asashour asashour Feb 23, 2023

Choose a reason for hiding this comment

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

From what I know, if there is a null passed during runtime, an exception would be thrown. That's the main motivation for dart-lang/sdk#51367

So, the previous code never sent a null.

Copy link
Contributor

@christopherfujino christopherfujino Feb 23, 2023

Choose a reason for hiding this comment

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

We get a lot of TypeErrors at runtime :)

Copy link
Contributor

Choose a reason for hiding this comment

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

However, this SGTM per Ben's comment

@christopherfujino
Copy link
Contributor

Per https://github.com/flutter/flutter/wiki/Tree-hygiene#tests, I think you'll either need to add tests or request an exemption (I think an exemption would be reasonable here, but it's ultimately not my call)

@asashour
Copy link
Contributor Author

asashour commented Mar 9, 2023

I am under the impression that the exemption is not needed, as long as the bot doesn't ask for tests.

Anyway, a test exemption was requested.

@christopherfujino
Copy link
Contributor

I am under the impression that the exemption is not needed, as long as the bot doesn't ask for tests.

Anyway, a test exemption was requested.

Ahh, good point, you're right, my bad!

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 9, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 9, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 9, 2023

auto label is removed for flutter/flutter, pr: 121321, due to - Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 9, 2023

auto label is removed for flutter/flutter, pr: 121321, due to Validations Fail.

@CaseyHillers
Copy link
Contributor

test-exempt: Analysis fix before landing the lint in Dart

Copy link
Contributor

@andrewkolos andrewkolos left a comment

Choose a reason for hiding this comment

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

LGTM

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2023
_dismissedBottomSheets.add(bottomSheet);
}
completer.complete();
completer.complete(null as T);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait a minute, is this a safe cast to make?

cc @goderbauer

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right. Is it just hiding a typing error elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please have a look at this particular dart-lang/sdk#51367 (comment) and dart-lang/sdk#51367 (comment)

The current Flutter usage is actually null.

Copy link
Member

Choose a reason for hiding this comment

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

My understanding from reading those comments is that the old code is unsafe (and that there may soon be a warning about this). This change silences that warning, but the code still remains unsafe: There is no guarantee that T is actually nullable, so this may still throw at runtime.

So, instead of just making sure the warning doesn't show up, we should actually fix the unsafe code here.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 6, 2023

auto label is removed for flutter/flutter, pr: 121321, due to This PR has not met approval requirements for merging. Changes were requested by {christopherfujino}, please make the needed changes and resubmit this PR.
You have project association CONTRIBUTOR and need 1 more review(s) in order to merge this PR.

  • Merge guidelines: You need at least one approved review if you are already a MEMBER or two member reviews if you are not a MEMBER before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 6, 2023

auto label is removed for flutter/flutter, pr: 121321, due to - This pull request has changes requested by @christopherfujino. Please resolve those before re-applying the label.

final AnimationController controller = (transitionAnimationController ?? BottomSheet.createAnimationController(this))..forward();
setState(() {
_currentBottomSheet = _buildBottomSheet<T>(
_currentBottomSheet = _buildBottomSheet(
Copy link
Member

Choose a reason for hiding this comment

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

This is now guaranteed to return a PersistentBottomSheetController. Will that not cause trouble for the cast to PersistentBottomSheetController<T> below in line 2464 if T is not void?

TBH, I am not sure what T is supposed to represent here and unfortunately, it is not documented. However, we likely have to figure that out to fix the typing here. From looking at this briefly it seems like passing anything but void for T will cause trouble...

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you were supposed to be able to pass back a return value when closing the bottom sheet (and T was the type for that), but from the looks of it maybe that got never fully implemented?

Copy link
Contributor Author

@asashour asashour May 25, 2023

Choose a reason for hiding this comment

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

Sorry for late response.

The issue is that showBottomSheet expects a type T, and then the completer must return that a value of that type (if it is not void).

Yes, it seems that having T was meant, but never used.

I would think to either change the signature of showBottomSheet to not have a type (I guess this is a breaking change), or find a way to send a value if T is actually passed.

@christopherfujino
Copy link
Contributor

@asashour are you still interested in working on this PR?

@christopherfujino christopherfujino added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 4, 2023
@christopherfujino
Copy link
Contributor

will wait one more week, pinged @asashour in the discord.

@github-actions github-actions bot removed c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels May 25, 2023
@christopherfujino
Copy link
Contributor

Closing as stale, feel free to re-open if you choose to pick this up again @asashour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants