dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

Fix all static errors in migration result of package:async #40362

Closed MichaelRFairhurst closed 4 years ago

MichaelRFairhurst commented 4 years ago
~/.nnbd_trial_migration/async-master φ ~/dart/sdk/out/ReleaseX64/dart-sdk/bin/dartanalyzer --enable-experiment=non-nullable --dart-sdk=/home/mfairhurst//dart/sdk/out/ReleaseX64NNBD/dart-sdk lib/ test
Analyzing lib, test...
  error • The argument type 'FutureOr<T>? Function()' can't be assigned to the parameter type 'FutureOr<T> Function()'. • lib/src/async_memoizer.dart:43:50 • argument_type_not_assignable
  error • The function expression type 'FutureOr<R> Function()' isn't of type 'FutureOr<R> Function()'. This means its parameter or return type doesn't match what is expected. Consider changing parameter type(s) or the returned type(s). • lib/src/cancelable_operation.dart:100:42 • invalid_cast_function_expr
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:100:42 • argument_type_not_assignable
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:102:42 • argument_type_not_assignable
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:110:42 • argument_type_not_assignable
  error • The function expression type 'FutureOr<R> Function()' isn't of type 'FutureOr<R> Function()'. This means its parameter or return type doesn't match what is expected. Consider changing parameter type(s) or the returned type(s). • lib/src/cancelable_operation.dart:110:42 • invalid_cast_function_expr
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'EventSink<T?>'. • lib/src/delegate/event_sink.dart:26:7 • return_of_invalid_type
  error • The argument type 'FutureOr<dynamic>' can't be assigned to the parameter type 'FutureOr<void> Function()'. • lib/src/delegate/future.dart:36:67 • argument_type_not_assignable
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'Sink<T?>'. • lib/src/delegate/sink.dart:24:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamConsumer<T?>'. • lib/src/delegate/stream_consumer.dart:26:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamSink<T?>'. • lib/src/delegate/stream_sink.dart:29:7 • return_of_invalid_type
  error • The argument type 'Null' can't be assigned to the parameter type 'T'. • lib/src/future_group.dart:64:17 • argument_type_not_assignable
  error • The argument type 'EventSink<dynamic>' can't be assigned to the parameter type 'EventSink<T?>'. • lib/src/result/release_sink.dart:17:18 • argument_type_not_assignable
  error • The return type 'ErrorResult' isn't a 'Result<T>', as required by the closure's context. • lib/src/result/result.dart:67:14 • return_of_invalid_type_from_closure
  error • A value of type 'ErrorResult' can't be returned from function 'error' because it has a return type of 'Result<T>'. • lib/src/result/result.dart:80:7 • return_of_invalid_type
  error • The argument type 'FutureOr<T>' can't be assigned to the parameter type 'T'. • lib/src/result/result.dart:114:37 • argument_type_not_assignable
  error • A value of type 'ErrorResult?' can't be returned from method 'flatten' because it has a return type of 'Result<T>?'. • lib/src/result/result.dart:175:12 • return_of_invalid_type
  error • A value of type 'ErrorResult?' can't be returned from method 'flattenAll' because it has a return type of 'Result<List<T>>?'. • lib/src/result/result.dart:188:16 • return_of_invalid_type
  error • A value of type 'StreamSink<T>' can't be returned from function '_sink' because it has a return type of '_CompleterSink<T>'. • lib/src/stream_sink_completer.dart:30:34 • return_of_invalid_type
  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type
  error • A value of type 'HandlerTransformer<S, T?>' can't be returned from function 'fromHandlers' because it has a return type of 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:40:12 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamSinkTransformer<S?, T?>'. • lib/src/stream_sink_transformer.dart:58:7 • return_of_invalid_type
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:37:36 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:40:15 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:44:15 • unchecked_use_of_nullable_value
  error • The argument type 'Stream<FutureOr<Stream<String>?>> Function()' can't be assigned to the parameter type 'Stream<String>? Function()'. • test/async_cache_test.dart:77:30 • argument_type_not_assignable
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:78:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:79:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:80:13 • yield_of_invalid_type
  error • The expression is nullable and must be null-checked before it can be used. • test/future_group_test.dart:206:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/future_group_test.dart:207:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/future_group_test.dart:211:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/future_group_test.dart:216:14 • unchecked_use_of_nullable_value
  error • The type 'Iterable<Result<dynamic>>' implied by the 'yield' expression must be assignable to 'Iterable<Result<int>>'. • test/result/result_flattenAll_test.dart:17:13 • yield_of_invalid_type
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:70:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:90:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:108:27 • invalid_assignment
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:123:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:135:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:136:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:206:24 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:213:28 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:214:31 • unchecked_use_of_nullable_value
  error • The argument type 'Result<int>?' can't be assigned to the parameter type 'Result<dynamic>'. • test/result/result_test.dart:247:18 • argument_type_not_assignable
  error • The argument type 'Result<int>?' can't be assigned to the parameter type 'Result<dynamic>'. • test/result/result_test.dart:254:18 • argument_type_not_assignable
  error • The argument type 'Result<dynamic>?' can't be assigned to the parameter type 'Result<dynamic>'. • test/result/result_test.dart:259:18 • argument_type_not_assignable
  error • A value of type 'Result<dynamic>' can't be assigned to a variable of type 'ErrorResult'. • test/result/result_test.dart:263:26 • invalid_assignment
  error • A value of type 'Result<dynamic>' can't be assigned to a variable of type 'ErrorResult'. • test/result/result_test.dart:273:26 • invalid_assignment
  error • A value of type 'Result<dynamic>' can't be assigned to a variable of type 'ErrorResult'. • test/result/result_test.dart:284:26 • invalid_assignment
  error • A value of type 'Result<dynamic>' can't be assigned to a variable of type 'ErrorResult'. • test/result/result_test.dart:295:26 • invalid_assignment
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:314:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:314:41 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:316:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:316:41 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:317:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/result/result_test.dart:317:44 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:90:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:91:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:92:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:97:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:98:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:106:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:107:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:108:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:117:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:121:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:124:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:125:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:126:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:127:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:131:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:135:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:138:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:139:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:144:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:154:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:157:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:158:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:159:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:160:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:165:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:169:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:177:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:184:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:194:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:195:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:199:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:203:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:207:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:214:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:215:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:219:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:228:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:231:5 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:234:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:239:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:242:5 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:245:12 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:261:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:262:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:263:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:276:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:277:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:278:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:282:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:283:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:286:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:291:5 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:292:18 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_completer_test.dart:293:18 • unchecked_use_of_nullable_value
  error • This expression has a type of 'void' so its value can't be used. • test/subscription_stream_test.dart:68:12 • use_of_void_result
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:92:9 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:143:13 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:191:13 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:222:9 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:259:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:266:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:271:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:276:7 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:281:14 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/subscription_transformer_test.dart:285:7 • unchecked_use_of_nullable_value
  error • The argument type 'Function' can't be assigned to the parameter type 'FutureOr<dynamic> Function()'. • test/utils.dart:120:46 • argument_type_not_assignable
  warning • The left operand can't be null, so the right operand is never executed. • lib/src/null_stream_sink.dart:73:50 • dead_null_coalesce
122 errors and 1 warning found.
MichaelRFairhurst commented 4 years ago

With crashes fixed, we're down to 43 errors and 1 warning

Analyzing lib, test...
  error • The argument type 'FutureOr<T>? Function()' can't be assigned to the parameter type 'FutureOr<T> Function()'. • lib/src/async_memoizer.dart:43:50 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:54:27 • argument_type_not_assignable
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:102:42 • argument_type_not_assignable
  error • The return type 'FutureOr<R>?' isn't a 'FutureOr<R>', as required by the closure's context. • lib/src/cancelable_operation.dart:110:48 • return_of_invalid_type_from_closure
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:110:56 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:112:35 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:195:28 • argument_type_not_assignable
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'EventSink<T?>'. • lib/src/delegate/event_sink.dart:28:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'Sink<T?>'. • lib/src/delegate/sink.dart:26:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamConsumer<T?>'. • lib/src/delegate/stream_consumer.dart:28:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamSink<T?>'. • lib/src/delegate/stream_sink.dart:31:7 • return_of_invalid_type
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/future_group.dart:81:32 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/null_stream_sink.dart:52:29 • argument_type_not_assignable
  error • The return type 'ErrorResult' isn't a 'Result<T>', as required by the closure's context. • lib/src/result/result.dart:67:14 • return_of_invalid_type_from_closure
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/result/result.dart:67:26 • argument_type_not_assignable
  error • A value of type 'ErrorResult' can't be returned from function 'error' because it has a return type of 'Result<T>'. • lib/src/result/result.dart:80:7 • return_of_invalid_type
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/result/result.dart:89:25 • argument_type_not_assignable
  error • A value of type 'ErrorResult?' can't be returned from method 'flatten' because it has a return type of 'Result<T>?'. • lib/src/result/result.dart:176:12 • return_of_invalid_type
  error • A value of type 'ErrorResult?' can't be returned from method 'flattenAll' because it has a return type of 'Result<List<T>>?'. • lib/src/result/result.dart:189:16 • return_of_invalid_type
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/stream_completer.dart:101:52 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/stream_queue.dart:486:33 • argument_type_not_assignable
  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type
  error • A value of type 'HandlerTransformer<S, T?>' can't be returned from function 'fromHandlers' because it has a return type of 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:40:12 • return_of_invalid_type
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:37:36 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:40:15 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:44:15 • unchecked_use_of_nullable_value
  error • The argument type 'Stream<FutureOr<Stream<String>?>> Function()' can't be assigned to the parameter type 'Stream<String>? Function()'. • test/async_cache_test.dart:77:30 • argument_type_not_assignable
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:78:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:79:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:80:13 • yield_of_invalid_type
  error • A value of type 'ErrorResult' can't be returned from function 'err' because it has a return type of 'Result<T>'. • test/result/result_flattenAll_test.dart:10:24 • return_of_invalid_type
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:70:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:90:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:108:27 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:147:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:150:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:184:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:187:19 • invalid_assignment
  error • A value of type 'CancelableOperation<Null>' can't be assigned to a variable of type 'CancelableOperation<Never>'. • test/stream_queue_test.dart:1100:46 • invalid_assignment
  error • Couldn't infer type parameter 'S'.

Tried to infer 'Null' for 'S' which doesn't work:
  Return type declared as 'CancelableOperation<S>?'
              used where  'CancelableOperation<Never>?' is required.

Consider passing explicit type argument(s) to the generic.

 • test/stream_queue_test.dart:1100:54 • could_not_infer
  error • Couldn't infer type parameter 'T'.

Tried to infer 'Null' for 'T' which doesn't work:
  Return type declared as 'T* Function()*'
              used where  'Never Function()' is required.

Consider passing explicit type argument(s) to the generic.

 • test/stream_zip_test.dart:257:29 • could_not_infer
  error • A value of type 'Null* Function()*' can't be assigned to a variable of type 'Never Function()'. • test/stream_zip_test.dart:257:29 • invalid_assignment
  error • This expression has a type of 'void' so its value can't be used. • test/subscription_stream_test.dart:68:12 • use_of_void_result
  warning • The left operand can't be null, so the right operand is never executed. • lib/src/null_stream_sink.dart:73:50 • dead_null_coalesce
MichaelRFairhurst commented 4 years ago

Many of these are caused by #40383. Not adding that as a blocker because its related but not blocking.

With implicit downcasts reenabled, we get 29 errors and 1 warning.

Analyzing lib, test...
  error • The argument type 'FutureOr<T>? Function()' can't be assigned to the parameter type 'FutureOr<T> Function()'. • lib/src/async_memoizer.dart:43:50 • argument_type_not_assignable
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:102:42 • argument_type_not_assignable
  error • The return type 'FutureOr<R>?' isn't a 'FutureOr<R>', as required by the closure's context. • lib/src/cancelable_operation.dart:110:48 • return_of_invalid_type_from_closure
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'EventSink<T?>'. • lib/src/delegate/event_sink.dart:28:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'Sink<T?>'. • lib/src/delegate/sink.dart:26:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamConsumer<T?>'. • lib/src/delegate/stream_consumer.dart:28:7 • return_of_invalid_type
  error • A value of type 'Object' can't be returned from method 'typed' because it has a return type of 'StreamSink<T?>'. • lib/src/delegate/stream_sink.dart:31:7 • return_of_invalid_type
  error • The return type 'ErrorResult' isn't a 'Result<T>', as required by the closure's context. • lib/src/result/result.dart:67:14 • return_of_invalid_type_from_closure
  error • A value of type 'ErrorResult' can't be returned from function 'error' because it has a return type of 'Result<T>'. • lib/src/result/result.dart:80:7 • return_of_invalid_type
  error • A value of type 'ErrorResult?' can't be returned from method 'flatten' because it has a return type of 'Result<T>?'. • lib/src/result/result.dart:176:12 • return_of_invalid_type
  error • A value of type 'ErrorResult?' can't be returned from method 'flattenAll' because it has a return type of 'Result<List<T>>?'. • lib/src/result/result.dart:189:16 • return_of_invalid_type
  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type
  error • A value of type 'HandlerTransformer<S, T?>' can't be returned from function 'fromHandlers' because it has a return type of 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:40:12 • return_of_invalid_type
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:37:36 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:40:15 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:44:15 • unchecked_use_of_nullable_value
  error • The argument type 'Stream<FutureOr<Stream<String>?>> Function()' can't be assigned to the parameter type 'Stream<String>? Function()'. • test/async_cache_test.dart:77:30 • argument_type_not_assignable
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:78:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:79:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:80:13 • yield_of_invalid_type
  error • A value of type 'ErrorResult' can't be returned from function 'err' because it has a return type of 'Result<T>'. • test/result/result_flattenAll_test.dart:10:24 • return_of_invalid_type
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:70:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:90:27 • invalid_assignment
  error • A value of type 'ErrorResult' can't be assigned to a variable of type 'Result<bool>'. • test/result/result_test.dart:108:27 • invalid_assignment
  error • A value of type 'CancelableOperation<Null>' can't be assigned to a variable of type 'CancelableOperation<Never>'. • test/stream_queue_test.dart:1100:46 • invalid_assignment
  error • Couldn't infer type parameter 'S'.

Tried to infer 'Null' for 'S' which doesn't work:
  Return type declared as 'CancelableOperation<S>?'
              used where  'CancelableOperation<Never>?' is required.

Consider passing explicit type argument(s) to the generic.

 • test/stream_queue_test.dart:1100:54 • could_not_infer
  error • A value of type 'Null* Function()*' can't be assigned to a variable of type 'Never Function()'. • test/stream_zip_test.dart:257:29 • invalid_assignment
  error • Couldn't infer type parameter 'T'.

Tried to infer 'Null' for 'T' which doesn't work:
  Return type declared as 'T* Function()*'
              used where  'Never Function()' is required.

Consider passing explicit type argument(s) to the generic.

 • test/stream_zip_test.dart:257:29 • could_not_infer
  error • This expression has a type of 'void' so its value can't be used. • test/subscription_stream_test.dart:68:12 • use_of_void_result
MichaelRFairhurst commented 4 years ago
  error • The argument type 'FutureOr<T>? Function()' can't be assigned to the parameter type 'FutureOr<T> Function()'. • lib/src/async_memoizer.dart:43:50 • argument_type_not_assignable
  error • The argument type 'FutureOr<R>? Function()' can't be assigned to the parameter type 'FutureOr<R> Function()'. • lib/src/cancelable_operation.dart:102:42 • argument_type_not_assignable
  error • The return type 'FutureOr<R>?' isn't a 'FutureOr<R>', as required by the closure's context. • lib/src/cancelable_operation.dart:110:48 • return_of_invalid_type_from_closure

These are all in the "what can we do" category. They all involve a migrated API like completer.complete(callback) which accepts Future<T>. And its given a callback that returns null in test code. So it seems like the callback should return Future<T>?, because it does, its just that that's not allowed. And since its a callback, we can't just add a! (though we could add a cast...and if we do, it will fail at runtime...) See #38707

Filed specifically as https://github.com/dart-lang/sdk/issues/40384

However, in addition to implementing that in the tool, ultimately this should be fixed in terms of refactoring the tests.

MichaelRFairhurst commented 4 years ago

current situation is 25 errors and 1 warning

  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:54:27 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:110:56 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:112:35 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/cancelable_operation.dart:195:28 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/future_group.dart:81:32 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/null_stream_sink.dart:52:29 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/result/result.dart:67:26 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/result/result.dart:89:25 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/stream_completer.dart:101:52 • argument_type_not_assignable
  error • The argument type 'dynamic' can't be assigned to the parameter type 'Object'. • lib/src/stream_queue.dart:486:33 • argument_type_not_assignable
  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:37:37 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:40:15 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:44:15 • unchecked_use_of_nullable_value
  error • The argument type 'Stream<FutureOr<Stream<String>?>> Function()' can't be assigned to the parameter type 'Stream<String>? Function()'. • test/async_cache_test.dart:77:30 • argument_type_not_assignable
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:78:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:79:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:80:13 • yield_of_invalid_type
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:147:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:150:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:184:19 • invalid_assignment
  error • A value of type 'dynamic' can't be assigned to a variable of type 'Object'. • test/stream_completer_test.dart:187:19 • invalid_assignment
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_transformer_test.dart:22:18 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_transformer_test.dart:121:18 • unchecked_use_of_nullable_value
  error • This expression has a type of 'void' so its value can't be used. • test/subscription_stream_test.dart:68:12 • use_of_void_result
  warning • The left operand can't be null, so the right operand is never executed. • lib/src/null_stream_sink.dart:73:50 • dead_null_coalesce

With downcasts from dynamic reenabled, we get 11 errors and 1 warning.

  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:37:37 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:40:15 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • lib/src/stream_subscription_transformer.dart:44:15 • unchecked_use_of_nullable_value
  error • The argument type 'Stream<FutureOr<Stream<String>?>> Function()' can't be assigned to the parameter type 'Stream<String>? Function()'. • test/async_cache_test.dart:77:30 • argument_type_not_assignable
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:78:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:79:13 • yield_of_invalid_type
  error • The type 'Stream<String>' implied by the 'yield' expression must be assignable to 'Stream<FutureOr<Stream<String>?>>'. • test/async_cache_test.dart:80:13 • yield_of_invalid_type
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_transformer_test.dart:22:18 • unchecked_use_of_nullable_value
  error • The expression is nullable and must be null-checked before it can be used. • test/stream_sink_transformer_test.dart:121:18 • unchecked_use_of_nullable_value
  error • This expression has a type of 'void' so its value can't be used. • test/subscription_stream_test.dart:68:12 • use_of_void_result
  warning • The left operand can't be null, so the right operand is never executed. • lib/src/null_stream_sink.dart:73:50 • dead_null_coalesce
MichaelRFairhurst commented 4 years ago
  error • The return type 'StreamTransformerWrapper<S, T>' of the redirected constructor isn't assignable to 'StreamSinkTransformer<S, T>'. • lib/src/stream_sink_transformer.dart:27:46 • redirect_to_invalid_return_type

is caused be https://github.com/dart-lang/sdk/issues/40551

srawlins commented 4 years ago

Since package:async has now been migrated, we should use a different target for continued work.