Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Side by Side Diff: pkg/analyzer/lib/src/generated/error.dart

Issue 2176693003: Issue a strong mode warning for type inference that is unsafe with AST-based summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.error; 5 library analyzer.src.generated.error;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode;
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 StrongModeCode.INFERRED_TYPE_CLOSURE, 2874 StrongModeCode.INFERRED_TYPE_CLOSURE,
2875 StrongModeCode.INFERRED_TYPE_LITERAL, 2875 StrongModeCode.INFERRED_TYPE_LITERAL,
2876 StrongModeCode.INVALID_FIELD_OVERRIDE, 2876 StrongModeCode.INVALID_FIELD_OVERRIDE,
2877 StrongModeCode.INVALID_METHOD_OVERRIDE, 2877 StrongModeCode.INVALID_METHOD_OVERRIDE,
2878 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE, 2878 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE,
2879 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN, 2879 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN,
2880 StrongModeCode.INVALID_PARAMETER_DECLARATION, 2880 StrongModeCode.INVALID_PARAMETER_DECLARATION,
2881 StrongModeCode.INVALID_SUPER_INVOCATION, 2881 StrongModeCode.INVALID_SUPER_INVOCATION,
2882 StrongModeCode.NON_GROUND_TYPE_CHECK_INFO, 2882 StrongModeCode.NON_GROUND_TYPE_CHECK_INFO,
2883 StrongModeCode.STATIC_TYPE_ERROR, 2883 StrongModeCode.STATIC_TYPE_ERROR,
2884 StrongModeCode.UNSAFE_BLOCK_CLOSURE_INFERENCE,
2884 2885
2885 TodoCode.TODO, 2886 TodoCode.TODO,
2886 2887
2887 // 2888 //
2888 // parser.dart: 2889 // parser.dart:
2889 // 2890 //
2890 ParserErrorCode.ABSTRACT_CLASS_MEMBER, 2891 ParserErrorCode.ABSTRACT_CLASS_MEMBER,
2891 ParserErrorCode.ABSTRACT_ENUM, 2892 ParserErrorCode.ABSTRACT_ENUM,
2892 ParserErrorCode.ABSTRACT_STATIC_METHOD, 2893 ParserErrorCode.ABSTRACT_STATIC_METHOD,
2893 ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, 2894 ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION,
(...skipping 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after
5890 * 5891 *
5891 * These error codes tend to use the same message across different severity 5892 * These error codes tend to use the same message across different severity
5892 * levels, so they are grouped for clarity. 5893 * levels, so they are grouped for clarity.
5893 * 5894 *
5894 * All of these error codes also use the "STRONG_MODE_" prefix in their name. 5895 * All of these error codes also use the "STRONG_MODE_" prefix in their name.
5895 */ 5896 */
5896 class StrongModeCode extends ErrorCode { 5897 class StrongModeCode extends ErrorCode {
5897 static const String _implicitCastMessage = 5898 static const String _implicitCastMessage =
5898 'Unsound implicit cast from {0} to {1}'; 5899 'Unsound implicit cast from {0} to {1}';
5899 5900
5901 static const String _unsafeBlockClosureInferenceMessage =
5902 'Unsafe use of block closure in a type-inferred variable outside a '
5903 'function body. Workaround: add a type annotation for `{0}`. See '
5904 'dartbug.com/26947';
5905
5900 static const String _typeCheckMessage = 5906 static const String _typeCheckMessage =
5901 'Type check failed: {0} is not of type {1}'; 5907 'Type check failed: {0} is not of type {1}';
5902 5908
5903 static const String _invalidOverrideMessage = 5909 static const String _invalidOverrideMessage =
5904 'The type of {0}.{1} ({2}) is not a ' 5910 'The type of {0}.{1} ({2}) is not a '
5905 'subtype of {3}.{1} ({4}).'; 5911 'subtype of {3}.{1} ({4}).';
5906 5912
5907 /** 5913 /**
5908 * This is appended to the end of an error message about implicit dynamic. 5914 * This is appended to the end of an error message about implicit dynamic.
5909 * 5915 *
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
6037 'IMPLICIT_DYNAMIC_METHOD', 6043 'IMPLICIT_DYNAMIC_METHOD',
6038 "Missing type arguments for generic method '{0}<{1}>'" 6044 "Missing type arguments for generic method '{0}<{1}>'"
6039 "$_implicitDynamicTip"); 6045 "$_implicitDynamicTip");
6040 6046
6041 static const StrongModeCode IMPLICIT_DYNAMIC_INVOKE = const StrongModeCode( 6047 static const StrongModeCode IMPLICIT_DYNAMIC_INVOKE = const StrongModeCode(
6042 ErrorType.COMPILE_TIME_ERROR, 6048 ErrorType.COMPILE_TIME_ERROR,
6043 'IMPLICIT_DYNAMIC_INVOKE', 6049 'IMPLICIT_DYNAMIC_INVOKE',
6044 "Missing type arguments for calling generic function type '{0}'" 6050 "Missing type arguments for calling generic function type '{0}'"
6045 "$_implicitDynamicTip"); 6051 "$_implicitDynamicTip");
6046 6052
6053 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE =
6054 const StrongModeCode(
6055 ErrorType.STATIC_WARNING,
6056 'UNSAFE_BLOCK_CLOSURE_INFERENCE',
6057 _unsafeBlockClosureInferenceMessage);
6058
6047 @override 6059 @override
6048 final ErrorType type; 6060 final ErrorType type;
6049 6061
6050 /** 6062 /**
6051 * Initialize a newly created error code to have the given [type] and [name]. 6063 * Initialize a newly created error code to have the given [type] and [name].
6052 * 6064 *
6053 * The message associated with the error will be created from the given 6065 * The message associated with the error will be created from the given
6054 * [message] template. The correction associated with the error will be 6066 * [message] template. The correction associated with the error will be
6055 * created from the optional [correction] template. 6067 * created from the optional [correction] template.
6056 */ 6068 */
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 * Initialize a newly created error code to have the given [name]. 6105 * Initialize a newly created error code to have the given [name].
6094 */ 6106 */
6095 const TodoCode(String name) : super(name, "{0}"); 6107 const TodoCode(String name) : super(name, "{0}");
6096 6108
6097 @override 6109 @override
6098 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; 6110 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
6099 6111
6100 @override 6112 @override
6101 ErrorType get type => ErrorType.TODO; 6113 ErrorType get type => ErrorType.TODO;
6102 } 6114 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | pkg/analyzer/lib/src/task/strong/checker.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698