Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index 3500d4a3d96cfc77daf03d3ed9eab30674f53663..c3cb4e25f823bcf8b8dfcb53c19b12af1d474b0c 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -847,14 +847,16 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
? ErrorVerifier.getStaticType(lhs) |
: leftVariableElement.type; |
DartType staticRightType = ErrorVerifier.getStaticType(rhs); |
- if (!_typeSystem.isAssignableTo(staticRightType, leftType)) { |
+ if (!_typeSystem.isAssignableTo(staticRightType, leftType, |
+ isDeclarationCast: true)) { |
// The warning was generated on this rhs |
return false; |
} |
// Test for, and then generate the hint |
DartType bestRightType = rhs.bestType; |
if (leftType != null && bestRightType != null) { |
- if (!_typeSystem.isAssignableTo(bestRightType, leftType)) { |
+ if (!_typeSystem.isAssignableTo(bestRightType, leftType, |
+ isDeclarationCast: true)) { |
_errorReporter.reportTypeErrorForNode( |
HintCode.INVALID_ASSIGNMENT, rhs, [bestRightType, leftType]); |
return true; |