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

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

Issue 1423623005: Report hint when target of an invocation uses '?.', so can be null. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 engine.error; 5 library engine.error;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/task/model.dart'; 9 import 'package:analyzer/src/task/model.dart';
10 import 'package:analyzer/task/model.dart'; 10 import 'package:analyzer/task/model.dart';
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 * 2925 *
2926 * Parameters: 2926 * Parameters:
2927 * 0: the name of the actual argument type 2927 * 0: the name of the actual argument type
2928 * 1: the name of the expected type 2928 * 1: the name of the expected type
2929 */ 2929 */
2930 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode( 2930 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode(
2931 'ARGUMENT_TYPE_NOT_ASSIGNABLE', 2931 'ARGUMENT_TYPE_NOT_ASSIGNABLE',
2932 "The argument type '{0}' cannot be assigned to the parameter type '{1}'"); 2932 "The argument type '{0}' cannot be assigned to the parameter type '{1}'");
2933 2933
2934 /** 2934 /**
2935 * When the target expression uses '?.' operator, it can be `null`, so all the
2936 * subsequent invocations should also use '?.' operator.
2937 */
2938 static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode(
2939 'CAN_BE_NULL_AFTER_NULL_AWARE',
2940 "The expression uses '?.', so can be 'null'",
2941 "Replace the '.' with a '?.' in the invocation");
2942
2943 /**
2935 * Dead code is code that is never reached, this can happen for instance if a 2944 * Dead code is code that is never reached, this can happen for instance if a
2936 * statement follows a return statement. 2945 * statement follows a return statement.
2937 */ 2946 */
2938 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code"); 2947 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code");
2939 2948
2940 /** 2949 /**
2941 * Dead code is code that is never reached. This case covers cases where the 2950 * Dead code is code that is never reached. This case covers cases where the
2942 * user has catch clauses after `catch (e)` or `on Object catch (e)`. 2951 * user has catch clauses after `catch (e)` or `on Object catch (e)`.
2943 */ 2952 */
2944 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode( 2953 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode(
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
5097 * Initialize a newly created error code to have the given [name]. 5106 * Initialize a newly created error code to have the given [name].
5098 */ 5107 */
5099 const TodoCode(String name) : super(name, "{0}"); 5108 const TodoCode(String name) : super(name, "{0}");
5100 5109
5101 @override 5110 @override
5102 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; 5111 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
5103 5112
5104 @override 5113 @override
5105 ErrorType get type => ErrorType.TODO; 5114 ErrorType get type => ErrorType.TODO;
5106 } 5115 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | pkg/analyzer/lib/src/generated/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698