| Index: pkg/analyzer/lib/src/task/strong/checker.dart
|
| diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
|
| index e09f6af3f3b8fec50d6c82c46e312c3ac9826b7d..505f549b3ce82e74d4d8a0decd008852096e7daf 100644
|
| --- a/pkg/analyzer/lib/src/task/strong/checker.dart
|
| +++ b/pkg/analyzer/lib/src/task/strong/checker.dart
|
| @@ -772,6 +772,8 @@ class CodeChecker extends RecursiveAstVisitor {
|
| {DartType from, bool opAssign: false, bool isDeclarationCast: false}) {
|
| from ??= _getDefiniteType(expr);
|
|
|
| + _hintOnFuzzyArrows(expr, to, from);
|
| +
|
| if (_needsImplicitCast(expr, to,
|
| from: from, isDeclarationCast: isDeclarationCast) ==
|
| true) {
|
| @@ -1075,6 +1077,19 @@ class CodeChecker extends RecursiveAstVisitor {
|
| return rules.anyParameterType(ft, (pt) => pt.isDynamic);
|
| }
|
|
|
| + void _hintOnFuzzyArrows(Expression expr, DartType to, DartType from) {
|
| + // If it is a subtype with fuzzy arrows on,
|
| + // check to see if it still is with them off.
|
| + if (rules.isSubtypeOf(from, to)) {
|
| + // Remove fuzzy arrows
|
| + var cFrom = rules.typeToConcreteType(from);
|
| + var cTo = rules.typeToConcreteType(to);
|
| + // If still true, no warning needed
|
| + if (rules.isSubtypeOf(cFrom, cTo)) return;
|
| + _recordMessage(expr, HintCode.USES_DYNAMIC_AS_BOTTOM, [from, to]);
|
| + }
|
| + }
|
| +
|
| /// Returns true if we need an implicit cast of [expr] from [from] type to
|
| /// [to] type, returns false if no cast is needed, and returns null if the
|
| /// types are statically incompatible.
|
| @@ -1224,7 +1239,9 @@ class CodeChecker extends RecursiveAstVisitor {
|
| errorCode.name.startsWith('STRONG_MODE_TOP_LEVEL_')) {
|
| severity = ErrorSeverity.ERROR;
|
| }
|
| - if (severity != ErrorSeverity.INFO || _options.strongModeHints) {
|
| + if (severity != ErrorSeverity.INFO ||
|
| + _options.strongModeHints ||
|
| + errorCode == HintCode.USES_DYNAMIC_AS_BOTTOM) {
|
| int begin = node is AnnotatedNode
|
| ? node.firstTokenAfterCommentAndMetadata.offset
|
| : node.offset;
|
|
|