Skip to content

implicit-casts: false#47199

Merged
fluttergithubbot merged 3 commits intoflutter:masterfrom
a14n:implicit-casts-false
Dec 19, 2019
Merged

implicit-casts: false#47199
fluttergithubbot merged 3 commits intoflutter:masterfrom
a14n:implicit-casts-false

Conversation

@a14n
Copy link
Contributor

@a14n a14n commented Dec 17, 2019

Description

Disable implicit-casts

Related 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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests 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 Dec 17, 2019
@fluttergithubbot
Copy link
Contributor

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be as dynamic until we determine if the type annotations are correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm. Looks like that won't work. I strongly suspect we just want the _rejectedAvatars collection to be <T> instead of <dynamic>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially tried to make some changes (like retype _rejectedAvatars) but there was always a test that failed.

Copy link
Contributor

Choose a reason for hiding this comment

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

_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.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like onLeave is just badly defined, should be types as <Object> rather than T.

BTW, avoid dynamic as much as possible. Prefer Object.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

@Hixie - do you know about the _rejectedAvatars? It looks like you're in the blame for it.


analyzer:
strong-mode:
implicit-casts: false
Copy link
Contributor

Choose a reason for hiding this comment

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

YES

@@ -674,7 +674,7 @@ class PlatformViewLayer extends Layer {
}
if (MouseTrackerAnnotation == S) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not for this PR but why isn't this S is MouseTrackerAnimation? @digiter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably have it say S == MouseTrackerAnnotation to make it clearer that the variable here is S.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

});
if (widget.onLeave != null)
widget.onLeave(avatar.data);
widget.onLeave(avatar.data 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.

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm. Looks like that won't work. I strongly suspect we just want the _rejectedAvatars collection to be <T> instead of <dynamic>.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM. Maybe we should add a TODO to fix the type weirdness around the rejectedAvatars bit.

@a14n
Copy link
Contributor Author

a14n commented Dec 17, 2019

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 :)

@dnfield
Copy link
Contributor

dnfield commented Dec 17, 2019

You can put me.

import 'package:flutter/foundation.dart';
import 'package:vector_math/vector_math_64.dart';

import '../../rendering.dart';
Copy link
Member

Choose a reason for hiding this comment

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

anything under rendering should not be importing rendering. Instead, you'll have to import the file from src/rendering directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@a14n
Copy link
Contributor Author

a14n commented Dec 17, 2019

You can put me.

Done

import 'package:flutter/foundation.dart';
import 'package:vector_math/vector_math_64.dart';

import '../rendering/layer.dart';
Copy link
Member

Choose a reason for hiding this comment

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

SHouldn't this just be

Suggested change
import '../rendering/layer.dart';
import 'layer.dart';

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, we should never import with ../foo/bar.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Done

@a14n
Copy link
Contributor Author

a14n commented Dec 18, 2019

PTAL

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit c235998 into flutter:master Dec 19, 2019
@chingjun
Copy link
Contributor

Reverting this commit, it failed analyzer and is blocking engine roll: https://cirrus-ci.com/task/6220779997364224

The failure is probably caused by c319f5f

chingjun added a commit that referenced this pull request Dec 19, 2019
chingjun added a commit that referenced this pull request Dec 19, 2019
a14n added a commit to a14n/flutter that referenced this pull request Dec 19, 2019
@a14n a14n mentioned this pull request Dec 19, 2019
9 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable implicit casts

7 participants