implicit-casts: false#47199
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. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| }); | ||
| if (widget.onLeave != null) | ||
| widget.onLeave(avatar.data); | ||
| widget.onLeave(avatar.data as T); |
There was a problem hiding this comment.
This one is strange because IIUC avatar could be in _rejectedAvatars (see the above assert) and so it could be something that is not a T.
Unfortunately I don't have enough context to know if it is really a problem and how to fix it.
There was a problem hiding this comment.
Should this just be as dynamic until we determine if the type annotations are correct?
There was a problem hiding this comment.
Hm. Looks like that won't work. I strongly suspect we just want the _rejectedAvatars collection to be <T> instead of <dynamic>.
There was a problem hiding this comment.
I initially tried to make some changes (like retype _rejectedAvatars) but there was always a test that failed.
There was a problem hiding this comment.
_rejectedAvatatars might not be T, it could be anything. Imagine you have two drag sources, one with Xs and one with Ys, and two drag targets, one for Xs and one for Ys. Drag from the X source to the Y target and it'll be an X rejected in the Y.
There was a problem hiding this comment.
looks like onLeave is just badly defined, should be types as <Object> rather than T.
BTW, avoid dynamic as much as possible. Prefer Object.
|
|
||
| analyzer: | ||
| strong-mode: | ||
| implicit-casts: false |
| @@ -674,7 +674,7 @@ class PlatformViewLayer extends Layer { | |||
| } | |||
| if (MouseTrackerAnnotation == S) { | |||
There was a problem hiding this comment.
not for this PR but why isn't this S is MouseTrackerAnimation? @digiter
There was a problem hiding this comment.
S is a Type object and will never be a MouseTrackerAnimation. I don't think there's a way to test that S extends/implements MouseTrackerAnimation
There was a problem hiding this comment.
we should probably have it say S == MouseTrackerAnnotation to make it clearer that the variable here is S.
| }); | ||
| if (widget.onLeave != null) | ||
| widget.onLeave(avatar.data); | ||
| widget.onLeave(avatar.data as T); |
There was a problem hiding this comment.
Should this just be as dynamic until we determine if the type annotations are correct?
| }); | ||
| if (widget.onLeave != null) | ||
| widget.onLeave(avatar.data); | ||
| widget.onLeave(avatar.data as T); |
There was a problem hiding this comment.
Hm. Looks like that won't work. I strongly suspect we just want the _rejectedAvatars collection to be <T> instead of <dynamic>.
dnfield
left a comment
There was a problem hiding this comment.
LGTM. Maybe we should add a TODO to fix the type weirdness around the rejectedAvatars bit.
The problem is to find the good nickname to use for this TODO :) |
|
You can put me. |
| import 'package:flutter/foundation.dart'; | ||
| import 'package:vector_math/vector_math_64.dart'; | ||
|
|
||
| import '../../rendering.dart'; |
There was a problem hiding this comment.
anything under rendering should not be importing rendering. Instead, you'll have to import the file from src/rendering directly.
Done |
| import 'package:flutter/foundation.dart'; | ||
| import 'package:vector_math/vector_math_64.dart'; | ||
|
|
||
| import '../rendering/layer.dart'; |
There was a problem hiding this comment.
SHouldn't this just be
| import '../rendering/layer.dart'; | |
| import 'layer.dart'; |
There was a problem hiding this comment.
yes, we should never import with ../foo/bar.dart
|
PTAL |
|
Reverting this commit, it failed analyzer and is blocking engine roll: https://cirrus-ci.com/task/6220779997364224 The failure is probably caused by c319f5f |
Description
Disable
implicit-castsRelated Issues
Fixes #13815
Tests
None because it's a refactoring.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?