-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sample analysis build jobs #2575
Changes from all commits
85f38a1
233950a
2e92ee5
18e4697
2d558ec
2d0d973
3ece334
7833912
f3738c6
0525765
a64ab42
0a88a2a
c3355b7
66a2ace
e6c098a
0e555d1
ef7995c
a850e36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
Analyzing analysis_options.yaml, lib... | ||
error • A value of type 'Object' can't be assigned to a variable of type 'String'. • lib/assignment.dart:11:14 • invalid_assignment | ||
error • A value of type 'String' can't be assigned to a variable of type 'int'. • lib/assignment.dart:19:11 • invalid_assignment | ||
error • A value of type 'String' can't be assigned to a variable of type 'int'. • lib/assignment.dart:26:11 • invalid_assignment | ||
error • Const variables must be initialized with a constant value. • lib/assignment.dart:34:13 • const_initialized_with_non_constant_value | ||
lint • Avoid empty statements. • lib/lint.dart:9:19 • empty_statements | ||
lint • Close instances of `dart.core.Sink`. • lib/lint.dart:16:7 • close_sinks | ||
1 error and 2 lints found. | ||
4 errors and 2 lints found. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
Analyzing analysis_options.yaml, bin, lib, test... | ||
# https://github.com/dart-lang/sdk/issues/32236 - flow analysis can't yet figure out that the variable is of type Person. | ||
error • 'Object' doesn't extend 'SomeBaseClass'. • lib/language_tour/generics/misc.dart:29:19 • type_argument_not_matching_bounds | ||
error • The argument type 'int' can't be assigned to the parameter type 'String'. • lib/library_tour/core/collections.dart:5:14 • argument_type_not_assignable | ||
error • A value of type 'dynamic' can't be assigned to a variable of type 'Person'. • lib/library_tour/core/hash_code.dart:24:21 • invalid_assignment | ||
3 errors found. | ||
2 errors found. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
void miscDeclAnalyzedButNotTested() { | ||
var fruits = List<String>(); | ||
// ignore_for_file: stable, dev, argument_type_not_assignable | ||
// ignore_for_file: stable, dev, argument_type_not_assignable, unused_local_variable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add beta to this list? Or remove the release names? (Is "beta" even supported? I don't see examples/strong/analyzer-results-beta.txt in this PR.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure? I can't quite figure out how that works. If there isn't a |
||
// #docregion List-of-String | ||
fruits.add(5); // Error: 'int' can't be assigned to 'String' | ||
// #enddocregion List-of-String | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
Analyzing analysis_options.yaml, lib, test... | ||
error • 'HoneyBadger.parent' ('Root Function()') isn't a valid override of 'Animal.parent' ('Animal Function()'). • lib/animal_bad.dart:15:12 • invalid_override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this file different from analyzer-results-stable.txt? If not, then maybe we should remove one of these files and delete "-stable" from the name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's identical. |
||
error • 'Cat.chase' ('void Function(Mouse)') isn't a valid override of 'Animal.chase' ('void Function(Animal)'). • lib/animal_bad.dart:26:8 • invalid_override | ||
error • A value of type 'List<dynamic>' can't be assigned to a variable of type 'List<Cat>'. • lib/animal_bad.dart:48:19 • invalid_assignment | ||
error • The method 'add' isn't defined for the type 'Iterable'. • lib/bounded/instantiate_to_bound.dart:7:5 • undefined_method | ||
error • A value of type 'Element' can't be assigned to a variable of type 'CanvasElement'. • lib/common_fixes_analysis.dart:21:28 • invalid_assignment | ||
error • A value of type 'int' can't be assigned to a variable of type 'bool'. • lib/common_problems_analysis.dart:14:14 • invalid_assignment | ||
error • The getter 'context2D' isn't defined for the type 'Element'. • lib/common_problems_analysis.dart:23:12 • undefined_getter | ||
error • A value of type 'double' can't be assigned to a variable of type 'int'. • lib/common_problems_analysis.dart:38:16 • invalid_assignment | ||
error • A value of type 'List<int>' can't be assigned to a variable of type 'List<String>'. • lib/common_problems_analysis.dart:46:27 • invalid_assignment | ||
error • 'MyAdder.add' ('int Function(int, int)') isn't a valid override of 'NumberAdder.add' ('num Function(num, num)'). • lib/common_problems_analysis.dart:61:7 • invalid_override | ||
error • 'Subclass.method' ('void Function(int)') isn't a valid override of 'Superclass.method' ('void Function(dynamic)'). • lib/common_problems_analysis.dart:74:8 • invalid_override | ||
error • The super call must be last in an initializer list (see https://goo.gl/EY6hDP): 'super(food)'. • lib/common_problems_analysis.dart:92:9 • invalid_super_invocation | ||
error • The function expression type 'bool Function(String)' isn't of type 'bool Function(dynamic)'. This means its parameter or return type doesn't match what is expected. Consider changing parameter type(s) or the returned type(s). • lib/common_problems_analysis.dart:102:17 • invalid_cast_function_expr | ||
error • A value of type 'bool Function(String)' can't be assigned to a variable of type 'bool Function(dynamic)'. • lib/common_problems_analysis.dart:102:17 • invalid_assignment | ||
error • The class 'MyList' cannot implement both 'List<int*>*' and 'List<dynamic>*' because the type arguments are different. • lib/dart_1_my_list_hello_world.dart:11:1 • conflicting_generic_interfaces | ||
error • Superinterfaces don't have a valid override for '+': ListMixin.+ (List<int> Function(List<int>)), List.+ (List<dynamic> Function(List<dynamic>)). • lib/dart_1_my_list_hello_world.dart:11:7 • inconsistent_inheritance | ||
error • 'ListMixin.add' ('void Function(int)') isn't a valid override of 'List.add' ('void Function(dynamic)'). • lib/dart_1_my_list_hello_world.dart:11:7 • invalid_override | ||
error • 'MyList.length' ('Object Function()') isn't a valid override of 'List.length' ('int Function()'). • lib/dart_1_my_list_hello_world.dart:12:10 • invalid_override | ||
error • A value of type 'String' can't be returned from method '[]' because it has a return type of 'int'. • lib/dart_1_my_list_hello_world.dart:16:25 • return_of_invalid_type | ||
error • The argument type 'List<dynamic>' can't be assigned to the parameter type 'List<int>'. • lib/strong_analysis.dart:27:17 • argument_type_not_assignable | ||
error • The argument type 'int' can't be assigned to the parameter type 'String'. • lib/strong_analysis.dart:38:15 • argument_type_not_assignable | ||
error • The argument type 'int' can't be assigned to the parameter type 'String'. • lib/strong_analysis.dart:54:15 • argument_type_not_assignable | ||
|
@@ -24,4 +17,4 @@ Analyzing analysis_options.yaml, lib, test... | |
error • A value of type 'List<dynamic>' can't be assigned to a variable of type 'List<int>'. • test/strong_test.dart:42:27 • invalid_assignment | ||
error • A value of type 'List<Animal>' can't be assigned to a variable of type 'List<Cat>'. • test/strong_test.dart:64:26 • invalid_assignment | ||
error • A value of type 'List<Object>' can't be assigned to a variable of type 'List<String>'. • test/strong_test.dart:178:26 • invalid_assignment | ||
25 errors found. | ||
18 errors found. |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1281,8 +1281,10 @@ num highScore(List<num> scores) { | |
} | ||
{% endprettify %} | ||
|
||
<!-- Q: As of 2.9, this code no longer works. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @munificent opinion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why doesn't it work? Because we're getting rid of implicit downcasts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, I think so. Here's the message, which complains about error * A value of type 'num' can't be assigned to a variable of type 'int'. * lib/effective_dart/design_bad.dart:79:38 * invalid_assignment
|
||
Should we change it or the recommendation? --> | ||
{:.bad} | ||
<?code-excerpt "misc/lib/effective_dart/design_bad.dart (inferred-wrong)" replace="/ +\/\/ ignore: .*?\n//g"?> | ||
<!-- code-excerpt "misc/lib/effective_dart/design_bad.dart (inferred-wrong)" replace="/ +\/\/ ignore: .*?\n//g" --> | ||
{% prettify dart tag=pre+code %} | ||
num highScore(List<num> scores) { | ||
var highest = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1072,8 +1072,10 @@ If a field doesn't depend on any constructor parameters, it can and should be | |
initialized at its declaration. It takes less code and makes sure you won't | ||
forget to initialize it if the class has multiple constructors. | ||
|
||
<!-- Q: As of 2.9, this code no longer works. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @munificent opinion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned this elsewhere, but to close the loop here, I think we should make |
||
Should we change it or the recommendation? --> | ||
{:.bad} | ||
<?code-excerpt "misc/lib/effective_dart/usage_bad.dart (field-init-at-decl)"?> | ||
<!-- code-excerpt "misc/lib/effective_dart/usage_bad.dart (field-init-at-decl)" --> | ||
{% prettify dart tag=pre+code %} | ||
class Folder { | ||
final String name; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just FYI I just merged a change that moves this snippet into dartpad_picker_main. I created an issue to track: #2581