text:
Detail the time asymptotic complexity of lint rules

As a developer I would like to know the asymptotic complexity of lint rules. Ideally I would like to have the best, average and worst time complexities (where appropriate) detailed in the individual lint rule documentation page.
Additional context
The dart analyser can be slowed when analysing big codebases. Some rules might be resource intensive in nature since more tree traversing/visiting needs to be performed. Having the asymptotic complexities for each rule would help developers decide if a rule is worth to be included or not.

I'd love something like this.  FWIW we do some pretty primitive rank-ordering on our benchmarking bot and despite how basic it is, it's been really handy in providing early warnings around performance degradation (though checking it is entirely manual).  Anyway, I've often thought even these crude numbers could be useful in sorting lints into some coarse-grained performance buckets.
Here's a recent run for example (https://github.com/dart-lang/linter/actions/runs/4187360395/jobs/7257088851):
--------------------------------------------------------------------------
Timings                                                                 ms
--------------------------------------------------------------------------
close_sinks                                                             91
use_late_for_private_fields_and_variables                               61
always_specify_types                                                    58
prefer_double_quotes                                                    49
avoid_redundant_argument_values                                         48
unreachable_from_main                                                   33
prefer_final_parameters                                                 32
unnecessary_overrides [core]                                            30
discarded_futures                                                       30
avoid_positional_boolean_parameters                                     30
depend_on_referenced_packages [core]                                    29
use_named_constants                                                     27
prefer_const_constructors [flutter]                                     27
unnecessary_string_escapes [recommended]                                27
directives_ordering                                                     27
cancel_subscriptions                                                    26
prefer_final_fields [recommended]                                       25
lines_longer_than_80_chars                                              25
require_trailing_commas                                                 24
non_constant_identifier_names [core]                                    24
use_build_context_synchronously [flutter]                               22
avoid_dynamic_calls                                                     21
void_checks [core]                                                      20
no_runtimeType_toString                                                 20
avoid_web_libraries_in_flutter [flutter]                                19
cascade_invocations                                                     19
null_closures [recommended]                                             18
avoid_type_to_string                                                    18
public_member_api_docs                                                  18
prefer_contains [recommended]                                           18
avoid_escaping_inner_quotes                                             17
collection_methods_unrelated_type                                       16
flutter_style_todos                                                     15
avoid_returning_this                                                    15
library_private_types_in_public_api [recommended]                       14
annotate_overrides [recommended]                                        14
prefer_final_locals                                                     14
control_flow_in_finally [recommended]                                   12
always_put_control_body_on_new_line                                     12
always_use_package_imports                                              12
prefer_const_constructors_in_immutables [flutter]                       11
use_to_and_as_if_applicable                                             11
prefer_const_declarations [flutter]                                     11
no_leading_underscores_for_local_identifiers [recommended]              10
implementation_imports [recommended]                                    10
unnecessary_parenthesis                                                 10
always_declare_return_types                                              9
overridden_fields [recommended]                                          9
prefer_initializing_formals [recommended]                                9
avoid_print [flutter]                                                    9
parameter_assignments                                                    9
file_names [core]                                                        9
type_annotate_public_apis                                                9
avoid_unused_constructor_parameters                                      9
use_key_in_widget_constructors [flutter]                                 9
unnecessary_lambdas                                                      8
unrelated_type_equality_checks [core]                                    8
slash_for_doc_comments [recommended]                                     8
avoid_types_as_parameter_names [core]                                    8
noop_primitive_operations                                                8
unnecessary_nullable_for_final_variable_declarations [recommended]       7
leading_newlines_in_multiline_strings                                    7
deprecated_consistency                                                   7
use_setters_to_change_properties                                         7
unawaited_futures                                                        7
prefer_relative_imports                                                  7
use_raw_strings                                                          7
always_put_required_named_parameters_first                               7
prefer_is_empty [core]                                                   7
unnecessary_statements                                                   7
unsafe_html                                                              7
avoid_renaming_method_parameters [recommended]                           7
avoid_slow_async_io                                                      7
unnecessary_null_aware_operator_on_extension_on_nullable                 7
prefer_collection_literals [recommended]                                 7
diagnostic_describe_all_properties                                       6
use_super_parameters                                                     6
avoid_init_to_null [recommended]                                         6
recursive_getters [recommended]                                          6
use_enums                                                                6
prefer_void_to_null [recommended]                                        6
avoid_final_parameters                                                   6
constant_identifier_names [recommended]                                  6
avoid_unnecessary_containers [flutter]                                   5
avoid_returning_null_for_void [recommended]                              5
join_return_with_assignment                                              5
sized_box_shrink_expand                                                  3
eol_at_end_of_file                                                       3
exhaustive_cases [recommended]                                           3
missing_whitespace_between_adjacent_strings                              3
prefer_iterable_whereType [core]                                         3
sized_box_for_whitespace [flutter]                                       3
prefer_foreach                                                           3
prefer_if_null_operators [recommended]                                   3
unnecessary_this [recommended]                                           3
use_decorated_box                                                        2
prefer_is_not_empty [core]                                               2
prefer_asserts_with_message                                              2
await_only_futures [core]                                                2
test_types_in_equals                                                     2
unnecessary_constructor_name [recommended]                               2
provide_deprecation_message [core]                                       2
sort_unnamed_constructors_first                                          2
prefer_mixin                                                             2
unnecessary_to_list_in_spreads                                           2
do_not_use_environment                                                   2
use_is_even_rather_than_modulo                                           2
unnecessary_brace_in_string_interps [recommended]                        2
avoid_single_cascade_in_expression_statements [recommended]              2
always_require_non_null_named_parameters [recommended]                   2
prefer_int_literals                                                      2
tighten_type_of_initializing_formals                                     2
prefer_null_aware_method_calls                                           2
prefer_for_elements_to_map_fromIterable [recommended]                    2
no_logic_in_create_state [flutter]                                       2
no_duplicate_case_values [core]                                          2
library_prefixes [recommended]                                           2
avoid_return_types_on_setters [recommended]                              2
unnecessary_null_in_if_null_operators [recommended]                      2
avoid_js_rounded_ints                                                    2
combinators_ordering                                                     2
avoid_implementing_value_types                                           2
invalid_case_patterns                                                    2
throw_in_finally                                                         2
one_member_abstracts                                                     2
avoid_double_and_int_checks                                              2
only_throw_errors                                                        2
prefer_adjacent_string_concatenation [recommended]                       2
camel_case_extensions [core]                                             1
conditional_uri_does_not_exist                                           1
avoid_bool_literals_in_conditional_expressions                           1
avoid_empty_else [core]                                                  1
prefer_generic_function_type_aliases [core]                              1
use_function_type_syntax_for_parameters [recommended]                    1
no_leading_underscores_for_library_prefixes [recommended]                1
unnecessary_new [recommended]                                            1
prefer_if_elements_to_conditional_expressions                            1
empty_statements [recommended]                                           1
avoid_returning_null                                                     1
empty_constructor_bodies [recommended]                                   1
no_default_cases                                                         1
avoid_catches_without_on_clauses                                         1
implicit_call_tearoffs                                                   1
empty_catches [core]                                                     1
avoid_returning_null_for_future                                          1
unnecessary_library_directive                                            1
unnecessary_late [recommended]                                           1
unnecessary_string_interpolations [recommended]                          1
type_init_formals [recommended]                                          1
use_rethrow_when_possible [recommended]                                  1
avoid_catching_errors                                                    1
prefer_null_aware_operators [recommended]                                1
cast_nullable_to_non_nullable                                            1
prefer_is_not_operator [recommended]                                     1
unnecessary_null_aware_assignments [recommended]                         1
use_string_in_part_of_directives                                         1
unnecessary_null_checks                                                  1
use_test_throws_matchers                                                 1
library_names [recommended]                                              1
sort_pub_dependencies                                                    0
enable_null_safety                                                       0
prefer_equal_for_default_values [recommended]                            0
avoid_as                                                                 0
unnecessary_breaks                                                       0
secure_pubspec_urls                                                      0
package_names [recommended]                                              0
invariant_booleans                                                       0
super_goes_last                                                          0
prefer_bool_in_asserts                                                   0
package_prefixed_library_names [core]                                    0
--------------------------------------------------------------------------
Total                                                                 1730
--------------------------------------------------------------------------

Thanks @pq for the comment!
I'm happy that you agree that classifying the lint rules depending on their performance is great. Thanks for supplying those crude numbers.
How do you think we should move forward with this?

We're pretty heads-down with work supporting upcoming language features so I'm not sure how many cycles I'll have right away but I'd be open to hearing design considerations and ideas.
Can you describe what you'd like to see in an ideal world?
/fyi @InMatrix who might may have ideas or pointers to prior art

authors: alestiago pq

repo: dart-lang/lints


text:
Barback should handle errors in isPrimary

This issue was originally filed by chri...@gmail.com

What steps will reproduce the problem?

Create an app with a Polymer transform in pubspec.yaml
pub serve
Edit the Polymer with Emacs

When Emacs opens a file for editing, it creates an interlock file (http://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html#Interlocking) in the same directory. This interlock is a symbolic link that points to a non-existent filename (meta information about the file is embedded).
Pub serve immediately crashes with the following error: "Cannot open file"
Simply making a change in the file causes the crash. Saving is not required.
Dart VM version: 1.1.1 (Wed Jan 15 04:11:49 2014) on "linux_x64"
Polymer version: 0.9.4

This issue has been moved to dart-lang/barback#28.

source: gharchive/issue

repo: dart-lang/sdk

license_type: permissive

license_source: github-api


text:
pub build packages directory for a Polymer app is too big

Reproduction steps:
$ cd runtime/bin/vmservice/client
$ pub build --mode=release
Look in build/web/packages
Specifically,
824K	./packages/polymer/src/js/polymer
That directory has *two* copies of polymer.js (polymer.js and polymer.concat.js). It also has two map files.
1.6M	./packages/web_components
Same problem here, directory has *two* copies of platform.js (platform.js and platform.concat.js). It also has two map files (each are half a meg in size!).
I'm not sure why .map files are being included in release mode build output.

This issue has been moved to dart-lang/polymer-dart#405.

authors: DartBot johnmccutchan


text:
Finalize and specify rules for local variable inference

The type inference rules for local variables declared without a type are pretty well-tested at this point, but I think there are a couple of corners to hammer out and then we need to add them to the spec.
Edit by @eernstg Feb 2018: Note that this is now essentially one of the subtasks of #31228.

Status update:
Ideally we would like to spec the rules for 1.50, but no other team should be affected, if this issue slips.

started:  I am working on this in the background, but as noted above, this is purely a spec issue with no implementation dependencies, so lower priority.

No Dart 2 milestone: This is now considered a subtask of #31228, which has a Dart 2 milestone.

I think this can be closed in favor of the local variable inference rules being written for Null Safety Dart.

authors: eernstg floitschG leafpetersen munificent srawlins


text:
language/disassemble_test hits assert

Test was initially ignored here: https://github.com/dart-lang/sdk/commit/f95701bf6119f41dfcda921268ff07836bd86898
Was removed (by mistake I suppose) here: https://github.com/dart-lang/sdk/commit/fc2458b8423979573ef3bdc70edf9711b38a99b2
But I couldn't fint an issue for it.
(lots of output)
tderr:
../../runtime/vm/object.h: 3557: error: expected: kind() != RawScript::kKernelTag
Dumping native stack trace for thread 6487
  [0x00000000009a1ee3] dart::Profiler::DumpStackTrace()
  [0x00000000009a1ee3] dart::Profiler::DumpStackTrace()
  [0x000000000068f0a1] dart::DynamicAssertionHelper::Fail(char const*, ...)
  [0x000000000091dea4] dart::Parser::Parser(dart::Script const&, dart::ParsedFunction*, dart::TokenPosition)
  [0x000000000092228d] dart::Parser::ParseFunction(dart::ParsedFunction*)
  [0x00000000006f3a6b] dart::Compiler::ComputeLocalVarDescriptors(dart::Code const&)
  [0x00000000008c4450] dart::Code::GetLocalVarDescriptors() const
  [0x0000000000725790] dart::Disassembler::DisassembleCodeHelper(char const*, dart::Code const&, bool)
  [0x00000000007266e2] dart::Disassembler::DisassembleCode(dart::Function const&, bool)
  [0x00000000006f2a59] Unknown symbol
  [0x00000000006f1f3e] dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&)
  [0x00000000006ed04b] dart::DRT_CompileFunction(dart::NativeArguments)
  [0x00007fbf320b8630] Unknown symbol
  [0x00007fbf320b86b0] Unknown symbol
  [0x00007fbf2ae413fb] Unknown symbol
  [0x00007fbf2ae40b74] Unknown symbol
  [0x00007fbf2ae3fd3a] Unknown symbol
  [0x00007fbf2ae3b9c9] Unknown symbol
  [0x00007fbf2ae39389] Unknown symbol
  [0x00007fbf2ae38c60] Unknown symbol
  [0x00007fbf2ae3866f] Unknown symbol
  [0x00007fbf320b8a4e] Unknown symbol
  [0x000000000070ac28] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)
-- End of DumpStackTrace

Command[vm]: DART_CONFIGURATION=DebugX64 out/DebugX64/dart --dfe=utils/kernel-service/kernel-service.dart --disassemble --print-variable-descriptors --no-background-compilation --ignore-unrecognized-flags --packages=/b/build/slave/vm-kernel-linux-debug-x64-be/build/sdk/.packages /b/build/slave/vm-kernel-linux-debug-x64-be/build/sdk/tests/language/disassemble_test.dart
Took 0:00:22.856170

Short reproduction command (experimental):
    python tools/test.py -cdartk -t120 language/disassemble_test

Ignoring test for now (https://codereview.chromium.org/2702553002/).

This happens when we try to compute local variable descriptors for a function that doesn't have them yet.  If the function has a pointer to a Kernel function (which might actually be a Kernel field) we will use the Kernel scope analysis on it, otherwise we will try to parse it with the parser.
This doesn't work for functions that have neither a pointer to a Kernel function nor an associated token stream, we'll end up in the parser without a token stream.  An example of such functions are invoke field dispatchers which are generated by the Kernel pipeline.
We need to either attach something to these as a Kernel function and properly interpret it, or else use a more sophisticated test (perhaps based on the script kind and the function kind) to see which pipeline to use and handle them correctly in the Kernel scope pipeline.

@kmillikin I'm working on getting more gardening issues assigned. If you're not the right person to assign this to, please reassign to that person.

This no longer seems to be an issue. Bisecting finds that it was fixed with 2109cc53bf58eed6c71c7fde4af5f4a334c8d3f7.
I'll create a CL to update the status file.

authors: jensjoha kmillikin nex3


text:
VM Crash while running 'pub-get' on MacOS

Flutter noticed sporadic crashes of pub get -- see https://github.com/flutter/flutter/issues/9727. The pub get process seems to exit with exitcode -4 which translates to illegal instruction.
@jakobr-google Has reproduced it on his machine by running it in a loop and we have the dart-sdk and a corresponding coredump at (release mode):
gs://dart-temp-crash-archive/jakob-pub-get-crash-core
gs://dart-temp-crash-archive/jakob-pub-get-crash-dart-sdk.tar.bz2

The Dart SDK version is 1.23.0-dev.11.11 .
It seems to crash during a fork() inside the MacOS libc/platform library.
@jakobr-google Will try to reproduce it again with bleeding edge, to see if the underlying issue might have already been fixed.
/cc @zanderso @a-siva @mraleph

I think the problem is that Mac's library called libnotify is not fork safe.
This library has a lazily initialized global state, which is created whenever _notify_globals function is called. Lazy initialization is guarded by a lock: initialization and guarding is done using os_alloc_once with key OS_ALLOC_ONCE_KEY_LIBSYSTEM_NOTIFY.
There is no special handling of this state in the prefork routines.
Post fork in a child libSystem_atfork_child invokes _notify_fork_child which starts by getting global library state via _notify_globals.
The absence of special handling in the prefork makes the following race possible:

The first thread starts initializing libnotify state - takes the lock.
The second thread forks - while libnotify state creation is in progress and OS_ALLOC_ONCE_KEY_LIBSYSTEM_NOTIFY slot is locked.

Because prefork does nothing to ensure that forking thread owns OS_ALLOC_ONCE_KEY_LIBSYSTEM_NOTIFY slot we arrive in the child with a OS_ALLOC_ONCE_KEY_LIBSYSTEM_NOTIFY slot locked by a non-existent thread, so when _os_alloc_once implementation attempts to wait on this lock it gets EOWNERDEAD error back and crashes with the following stack trace:
    frame #0: 0x00007fffd18bdc87 libsystem_platform.dylib`_os_once_gate_corruption_abort + 23
    frame #1: 0x00007fffd18bd99b libsystem_platform.dylib`_os_once_gate_wait_slow + 134
    frame #2: 0x00007fffd18b9a92 libsystem_platform.dylib`_os_alloc_once + 40
    frame #3: 0x00007fffd18b30ae libsystem_notify.dylib`_notify_fork_child + 215
    frame #4: 0x00007fffd0104b21 libSystem.B.dylib`libSystem_atfork_child + 49
    frame #5: 0x00007fffd16f1437 libsystem_c.dylib`fork + 47

As a workaround we could just force initialize libnotify state before forking.
I did an experiment to check when do we potentially initialize it - and it turns out that asking for local time initializes it:
 [0x00007fffbea81a92] _os_alloc_once
  [0x00007fffbea7c57a] notify_register_check
  [0x00007fffbe8fe3e5] notify_register_tz
  [0x00007fffbe8fde43] tzsetwall_basic
  [0x00007fffbe8ff844] localtime_r
  [0x0000000100337149] dart::OS::GetTimeZoneOffsetInSeconds(long long)
  [0x000000010007137d] dart::BootstrapNatives::DN_DateTime_timeZoneOffsetInSeconds(_Dart_NativeArguments*)
  [0x0000000100294563] dart::NativeEntry::LinkNativeCall(_Dart_NativeArguments*)
  [0x0000000100cc0719] [Stub] CallBootstrapCFunction
  [0x000000010294fa47] DateTime._timeZoneOffsetInSecondsForClampedSeconds
  [0x00000001029502e8] DateTime._timeZoneOffsetInSeconds
  [0x000000010294de6a] DateTime._localDateInUtcMicros
  [0x00000001029500c1] DateTime._parts
  [0x000000010294f8a4] DateTime.month

I filed a bug to Apple: 31962059

Your suggested workaround is to call OS::LocalTIme in the mac version of OS::InitOnce ?

@a-siva either that or call it right before forking.
We tried this sort of workaround with @jakobr-google and it seems that it fixed the problem.

I wrote and submitted the following reproduction to Apple:
https://gist.github.com/mraleph/e45db4d7a56bf65c3fe33e666bc31928

authors: a-siva mkustermann mraleph


text:
pub build failed

I use AggregateTransformer to concat all Angular template.hml file into a template.js file.
The transformer always print an error:
Build error:
Transforms {ADLJsBuild on adl_client|template} all emitted asset adl_client|web/js/templates.js.

before dart 1.23, even with this error, pub build generates the template.js file and the build is succeeds. Since dart 1.24.0, with this error, pub build failed. No file is generated or moved into the build folder at all.
Please advise, what cause the error? This is aggregate transformer and it only write the file once.
library adl_client.lib.adljs_transformer;

import 'dart:async';
import 'dart:io';
import 'package:barback/barback.dart';

class ADLJsBuildTransformer extends AggregateTransformer {

  ADLJsBuildTransformer.asPlugin();

  classifyPrimary(AssetId id) {
    if (id.path.startsWith('lib/js_src/directives') &&
        id.path.endsWith('tpl.html') &&
        Platform.isWindows == false) {
      return 'template';
    } else if ((id.path == 'lib/js_src/app.js'
        || id.path.startsWith('lib/js_src/directives')
        || id.path.startsWith('lib/js_src/filters')
        || id.path.startsWith('lib/js_src/services'))
        && id.path.endsWith('.js')
        && id.path.endsWith('-worker.js') == false) {
      return 'js';
    }
    return null;
  }

  Future apply(AggregateTransform transform) async {

    var content = new StringBuffer();

    var assets = await transform.primaryInputs.toList();

    AssetId id;

    switch(transform.key)
    {
      case 'template':
        var buffer = new StringBuffer();

        content.write("angular.module('templates', [\n");
        for (var asset in assets) {
          var template_name = asset.id.path.substring(11);
          content.write("  '${template_name}'");
          if (asset != assets.last) {
            content.write(',\n');
          }

          buffer.write("angular.module('${template_name}', []).run(['\$templateCache', function(\$templateCache) {\n");
          buffer.write("  \$templateCache.put('${template_name}',\n");

          var template = await asset.readAsString();
          var lines = template.split('\n').where((line) => line.isNotEmpty);
          for (var line in lines) {
            buffer.write('    \'${line.replaceAll('\'', '\\\'')}\'');

            if (line != lines.last) {
              buffer.write(' +\n');
            } else {
              buffer.write(');\n');
            }
          }
          buffer.write("}]);\n\n");
        }

        content.write(']);\n\n');
        content.write(buffer.toString());

        print("********** write to templates.js");
        id = new AssetId(transform.package, 'web/js/templates.js');
        break;

      case 'js':
        for (var asset in assets) {
          content.write(await asset.readAsString());
          content.write("\n");
        }

        id = new AssetId(transform.package, 'web/js/adl.js');
        break;
    }

    transform.addOutput(new Asset.fromString(id, content.toString()));
  }
}

pub build has been removed in favor of the new build_runner package, so closing this.

authors: kzhdev munificent


text:
analyzer doesn't resolve some symbol references within dartdoc comments when run with --use-fasta-parser

Specifically, if it's within a dartdoc comment for a class that's marked as abstract:
/** [String] */
class Foo {}

For the above, String will resolve.
/** [String] */
abstract class Bar {}

For the above, String will not resolve.
@danrubel

I hit this when dogfooding --use-fasta-parser - you can see it if you open the pkg/analyzer_plugin package from the sdk repo. You can see the issue in the lib/plugin/assist_mixin.dart file (and a few others) - they come up with unused imports warnings, as the imports have symbols that are only referenced from dartdoc comments.

And similarly, when dogfooding on the flutter codebase, the Document all public members lint fires. This only happens for abstract classes, even through they do have dartdoc comments. So I suspect that there's some issue recognizing a dartdoc comment before a class that has a leading abstract keyword.

@danrubel, honestly, from dogfooding this locally for a few hours, this may be the only blocking issue from enabling --use-fasta-parser by default.

Fixed in https://dart-review.googlesource.com/c/sdk/+/64140

authors: danrubel devoncarew


text:
Dart 2 tests should be audited to fix bad tests

It appears that a nontrivial fraction of failing test cases in the analyzer/FE integration are due to tests that are incorrect.  (In a random sampling of 60 of the ~500 failures currently outstanding, 4 appeared to be due to bad tests).  These tests need to be evaluated, and if they are indeed bad, fixed.
Suspected bad tests found so far:

language_2/compile_time_constant_static5_test/11

Test contains an implicit downcast that is invalid since it can be statically proven to always fail - see #31537

language_2/compile_time_constant_static5_test/16

Test contains an implicit downcast that is invalid since it can be statically proven to always fail - see #31537

language_2/compile_time_constant_static5_test/21

Test contains an implicit downcast that is invalid since it can be statically proven to always fail - see #31537

language_2/compile_time_constant_static5_test/23

Test contains an illegal assignment - see #31402

language_2/config_import_corelib_test

Test tries to call undefined methods on a type other than dynamic

language_2/deferred_load_library_wrong_args_test/01

Marked as a runtime error, should be a compile-time error

language_2/dynamic_prefix_core_test

Test assumes old semantics for dynamic (not a member of dart:core)

language_2/emit_const_fields_test

Test tries to call operator [] on an object whose static type is Object

language_2/external_test/24

Marked as a runtime error, should be a compile-time error

language_2/external_test/21

Marked as a runtime error, should be a compile-time error

language_2/generic_no_such_method_dispatcher_simple_test

Test tries to call undefined methods on a type other than dynamic

language_2/null_no_such_method_test

Test tries to call undefined methods on a type other than dynamic

language_2/override_inheritance_method_test/29

This test attempts to pair a base class method of type (int) -> dynamic with an override of type (String) -> dynamic, but does not expect an error

language_2/parser_quirks_test

Test tries to call undefined methods on a type other than dynamic

language_2/regress_23408_test

Test tries to call undefined methods on a type other than dynamic

language_2/regress_29025_test

Test assumes old call semantics

language_2/regress_29405_test

Test assumes old call semantics

language_2/regress_30339_test

Test contains invalid assignment errors

language_2/setter_no_getter_test/01

Marked as a runtime error, should be a compile-time error

language_2/string_split_test

Test contains an invalid override

language_2/string_supertype_checked_test

This test contains a class that implements Comparable, therefore the base class declaration of compareTo has type (dynamic) -> int, but the override has type (Comparable) -> int, which is an invalid override

language_2/super_bound_closure_test

Test tries to call undefined methods on a type other than dynamic

language_2/super_no_such_method1_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_no_such_method2_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_no_such_method3_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_operator_index5_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_operator_index6_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_operator_index7_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/super_operator_index8_test

Test attempts a super call to an abstract method; seems like this should be a compile-time error

language_2/type_promotion_functions_test

This whole test seems to be bad (has an unconditional compile time error at line 100)

language_2/type_promotion_more_specific_test/04

Test claims that type should not be promoted, but front end promotes it.  Which behavior is correct?

I'll keep this list updated if I discover more bad tests.

@leafpetersen and @lrhn - it may be useful to triage the failing language_2 tests to try and identify bad tests - esp. for tests like the first on Paul's list. I believe the dart 2 test migration effort did leave some amount of known work behind.

Right, type_promotion_functions_test is broken—it relies on the Dart 1 << relation. Should be rewritten such that the stated << relations become actual Dart 2 subtype relationships (e.g., FuncDynToDyn << FuncAtoDyn becomes FuncNullToDyn <: FuncAtoDyn where typedef FuncNullToDyn(Null n);).
Similarly, I agree that override_inheritance_method_test/29 should be adjusted to `//# 29: compile-time error'.
In string_supertype_checked_test, the comment refers to 'supertypes of String' which seems to have very little to do with the source code that follows, but one way to make the code meaningful today would be to use implements Comparable<A> and int compareTo(Comparable<A> other), which preserves the properties that the override uses variance and promote performs a cast.

the dart 2 test migration effort did leave some amount of known work behind.

Indeed, except perhaps for 'known [by all]'. ;)

As Erik says, it is a known issue that some of the language_2 tests are bad tests.  There was a issue in the tracker that they needed to be triaged, from at least a year ago, but I can't find that issue right now (maybe it's closed?) and as far as I can remember it never really had an owner anyway.
The usual thing we've been doing is fixing them as we find them.  Beware that it's very painful to do that due to the status file updates required.

I've now finished triaging the remaining test.py failures for analyzer/CFE integration, so I believe the list above is reasonably complete.

I'm currently fixing tests that are failing on large numbers of bots, including several of the ones listed. Many of these are language_2 tests that have a discrepancy between analyzer and CFE or which have been broken since the Dart 2 migration.

authors: devoncarew eernstg fishythefish kmillikin stereotype441


text:
"DOM streams silently drop events when the stream is paused. This is a bug and will be fixed"

I'm investigating an issue with dropped WebSocket events in the browser. It seems to be when the stream is paused:
int i = 0;
final WebSocket ws = new WebSocket('ws://demos.kaazing.com/echo');
ws.onOpen.listen((_) {
  new Timer.periodic(const Duration(milliseconds: 500),
      (_) => ws.sendString((i++).toString()));
  final sub = ws.onMessage.listen((e) => print(e.data));
  new Timer(const Duration(seconds: 5), () => sub.pause());
  new Timer(const Duration(seconds: 10), () => sub.resume());
  new Timer(const Duration(seconds: 15), () => sub.cancel());
});

According to the docs, the events should be buffered. I (re-)found that the docs say:

Currently DOM streams silently drop events when the stream is paused. This is a bug and will be fixed.

I don't know if this is the same issue (I'm assuming so, but I don't know if WebSockets events are "DOM streams") but that text was added 5 years ago but I can't find any other information on it (nor can I find an open issue here).
So, I'm wondering what the status is. Is it still considered a bug that will be fixed, or should the docs be updated? (Also - is it likely the same issue effecting web sockets?).

cc @lrhn

The DOM event streams are fairly special. Each time you read the onClick event getter, you get a new single-subscription stream. Internally that single-subscription stream adds and removes DOM event listeners when it's paused and resumed, so it doesn't provide the intermediate events in any way.
It used to be that way, I don't actually know if this is still the case.
That behavior is nontraditional, possibly unexpected, but it is not wrong. A single subscription stream is allowed to send whatever events it wants to. This is not a broadcast stream, there is no requirement that all listeners get the same events.
This is actually much closer to the model for streams we had hoped to introduce in Dart 2, where the distinction between broadcast and single-subscription streams was turned into variants of a more general stream behavior.
So, if the streams in question document the behavior, I'll retract the "bug" verdict and consider it a valid design choice.

Each time you read the onClick event getter, you get a new single-subscription stream. Internally that single-subscription stream adds and removes DOM event listeners when it's paused and resumed

Ah, I see why it behaves as it does then (though I'm not sure I understand why they're not just broadcast streams?).

For sockets, which are often streams of chunks of a larger entity, I think dropping events is a bug.

I think so too, though I guess it's easy to argue that I shouldn't pause the stream if I don't want this. The original code that exposed this was actually because we were calling asyncMap. When processing web sockets where the handler is async, but we need it to complete before we process the next message, asyncMap seemed like a valid solution - however this behaviour means we lose other messages instead of buffering them.
I worked around it by converting out web socket stream into a single-subscription stream like this:
Stream<T> convertBroadcastToSingleSubscriber<T>(Stream<T> stream) {
  final StreamController<T> controller = new StreamController<T>();
  StreamSubscription<T> subscription;
  controller.onListen =
      () => subscription = stream.listen((T e) => controller.add(e));
  controller.onCancel = () => subscription.cancel();
  return controller.stream;
}

However it feels a bit hacky. If it is decided to be by design though, it should probably be added to the docs where the current note is, since it's not obvious that the existing text applies to WebSockets (I also wonder if it's consistent between the browser and IO implementations - I haven't checked this).

It is a little hacky, but probably necessary since doing controller.addStream(stream) would propagate the pauses.
I'll keep this issue open as a bug-report against the HTML library.

authors: DanTup lrhn mit-mit


text:
Represent typedefs at runtime?

After switching to CFE, VM no longer creates classes for typedefs.
As a result, typedef's name is lost and not available at run time:

in type literals
in dart:mirrors
in messages of failed type checks

Consider the following example:
import 'dart:mirrors';

typedef bool Predicate(int);

main() {
  print(Predicate);
  print(reflectType(Predicate));
  print(42 as Predicate);
}

Currently (in Dart 2) it prints:
(dynamic) => bool
FunctionTypeMirror on '(dynamic) -> dart.core.bool'
Unhandled exception:
type 'int' is not a subtype of type '(dynamic) => bool' in type cast

When run on Dart SDK 1.24.3 this example prints
Predicate
TypedefMirror on 'Predicate'
Unhandled exception:
type 'int' is not a subtype of type 'Predicate' in type cast where
  int is from dart:core

What is the desired behavior?

If we would like to retain information about typedefs at run time, we should make sure CFE saves enough information about typedefs into kernel files and VM restores that info.
If the current behavior is OK, then we should cleanup dart:mirrrors API (deprecate/remove TypedefMirror) and cleanup all code related to typedef classes from VM.

/cc @lrhn @leafpetersen @rmacnak-google @a-siva

The language specification explicitly requires that two instances of Type that reify a type must be equal according to operator == when they reify the same type, and also mentions the special case \code{Type} instances for distinct type alias declarations declaring a name for the same function type are equal. The point is that reified types should faithfully reflect the underlying type.
However, it is also recommended that such reified types can differ in other ways (in particular, they can return different strings from toString()), such that developers can get access to additional information which may be helpful (such as "this reified type was obtained by evaluating the type alias named Foo").
So there is nothing in the language specification that prevents a type alias reification from being able to report the name of that type alias.
However, it may very well be a breaking change to start using different instances for the same underlying function type in cases where it is currently the same instance, because there may be usages where object identity is used (say, in a mapping from types to functions), so it's not obvious that we can just make the requested change for free.

I think the current behavior is OK. It's what I expect.
Dart class types are nominative, function types are structural. That means that two function types with the same type arguments, return type, and parameter signatures is the same function types. There is only one.
Type aliases are aliases, currently only for function types. We may introduce aliases for class types too.
As @eernstg wrote, that means that there can't be two different function types with the same function signature. It must be the same type.
Constant types are compile-time constants. We don't promise to canonicalize such types, but we do in some cases, and people might be relying on it.
Example:
So:
typedef F1 = int Function(int);
typedef F2 = int Function(int);
main() {
 const f1 = F1;
 const f2 = F2;
 print(f1 == f2); // Must print true. Fails in dart2js.
 print(identical(f1, f2));  // May print `true` or `false`, currently prints `true` on VM, `false` in dart2js.
}

print(f1 == f2); // Must print true. Fails in dart2js.

Just wondering if that would actually be true today, I just tried dart2js version 2.1.1-dev.3.2, and it does not fail.

It fails on version 2.2.0-edge (tip of tree), so this might be a regression.

@a-siva @rmacnak-google any thoughts?
Should we just do a cleanup in the VM and deprecate TypedefMirror?

I'd think that deprecating TypedefMirror would be one step too far. We have the following dartdoc for LibraryMirror.declarations:

Returns an immutable map of the declarations actually given in the library.
This map includes all regular methods, getters, setters, fields, classes and
typedefs actually declared in the library. The map is keyed by the simple
names of the declarations.

So I'd expect the following to work (that is, to compile and run without errors, and print something that makes sense for a TypedefMirror on F):
library main;
import 'dart:mirrors';

typedef int F(int);

main() {
  LibraryMirror libraryMirror = currentMirrorSystem().findLibrary(#main);
  TypedefMirror typedefMirror = libraryMirror.declarations[#F];
  print(typedefMirror);
}

Interestingly, it runs, but it prints 'null'!
This would imply that it is already impossible to find type alias declarations via the declarations of the enclosing library. But that looks like a bug to me! If you're exploring a library using the declarations of a mirror on it, wouldn't you expect to get to the type alias declarations? How would you explain that they are omitted?

authors: alexmarkov eernstg lrhn


text:
Android Studio Error Report Suggestion

Dart analysis server, SDK version 2.5.0-edge.1ef83b86ae637ffe7359173804cbc6d3fa25e6db, server version 1.27.2, error: Captured exception
type 'FunctionExpressionInvocationImpl' is not a subtype of type 'SuperExpression'
#0      AstBuilder.buildInitializer (package:analyzer/src/fasta/ast_builder.dart:401:25)
#1      AstBuilder.endInitializers (package:analyzer/src/fasta/ast_builder.dart:1369:44)
#2      Parser.parseInitializers (package:front_end/src/fasta/parser/parser.dart:2586:14)
#3      Parser.parseInitializersOpt (package:front_end/src/fasta/parser/parser.dart:2523:14)
#4      Parser.parseMethod (package:front_end/src/fasta/parser/parser.dart:3250:13)
#5      Parser.parseClassOrMixinMemberImpl (package:front_end/src/fasta/parser/parser.dart:3130:15)
#6      Parser.parseClassOrMixinBody (package:front_end/src/fasta/parser/parser.dart:2906:15)
#7      Parser.parseClass (package:front_end/src/fasta/parser/parser.dart:1797:13)
#8      Parser.parseClassOrNamedMixinApplication (package:front_end/src/fasta/parser/parser.dart:1757:14)
#9      Parser.parseTopLevelKeywordDeclaration (package:front_end/src/fasta/parser/parser.dart:572:14)
#10     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:468:14)
#11     Parser.parseUnit (package:front_end/src/fasta/parser/parser.dart:350:15)
#12     ParserAdapter.parseCompilationUnit2 (package:analyzer/src/generated/parser_fasta.dart:157:32)
#13     ParserAdapter.parseCompilationUnit (package:analyzer/src/generated/parser_fasta.dart:152:12)
#14     _File._parse (package:analyzer/src/services/available_declarations.dart:1839:23)
#15     _File.refresh (package:analyzer/src/services/available_declarations.dart:1160:30)
#16     DeclarationsTracker._performChangeFile (package:analyzer/src/services/available_declarations.dart:701:10)
#17     DeclarationsTracker.doWork (package:analyzer/src/services/available_declarations.dart:567:7)
#18     CompletionLibrariesWorker.performWork (package:analysis_server/src/domains/completion/available_suggestions.dart:283:13)
<asynchronous suspension>
#19     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:1901:35)
<asynchronous suspension>
#20     AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:1855:5)
#21     new AnalysisServer (package:analysis_server/src/analysis_server.dart:212:29)
#22     SocketServer.createAnalysisServer (package:analysis_server/src/socket_server.dart:86:26)
#23     StdioAnalysisServer.serveStdio (package:analysis_server/src/server/stdio_server.dart:37:18)
#24     Driver.startAnalysisServer.<anonymous closure> (package:analysis_server/src/server/driver.dart:572:21)
#25     _rootRun (dart:async/zone.dart:1124:13)
#26     _CustomZone.run (dart:async/zone.dart:1021:19)
#27     _runZoned (dart:async/zone.dart:1516:10)
#28     runZoned (dart:async/zone.dart:1463:12)
#29     Driver._captureExceptions (package:analysis_server/src/server/driver.dart:689:12)
#30     Driver.startAnalysisServer (package:analysis_server/src/server/driver.dart:570:7)
#31     Driver.start.<anonymous closure> (package:analysis_server/src/server/driver.dart:474:9)
#32     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#33     Driver.start.<anonymous closure> (package:analysis_server/src/server/driver.dart:469:43)
#34     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#35     new Future.sync (dart:async/future.dart:224:31)
#36     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#37     _rootRun (dart:async/zone.dart:1124:13)
#38     _CustomZone.run (dart:async/zone.dart:1021:19)
#39     _runZoned (dart:async/zone.dart:1516:10)
#40     runZoned (dart:async/zone.dart:1463:12)
#41     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#42     CompilerContext.runWithDefaultOptions (package:front_end/src/fasta/compiler_context.dart:140:56)
#43     Driver.start (package:analysis_server/src/server/driver.dart:469:21)
#44     main (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/analysis_server/bin/server.dart:12:11)
#45     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#46     main (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/analysis_server/bin/server.dart:10:10)
#47     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#48     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

1573853167019 => {"id":"7011","method":"edit.getFixes","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3858},"clientRequestTime":1573853167019}
1573853167021 <= {"id":"7011","result":{"fixes":[{"error":{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3858,"length":4,"s
1573853167022 => {"id":"7012","method":"edit.getFixes","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3858},"clientRequestTime":1573853167022}
1573853167025 <= {"id":"7012","result":{"fixes":[{"error":{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3858,"length":4,"s
1573853167036 => {"id":"7013","method":"edit.getAssists","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3862,"length":0},"clientRequestTime":1573853167036}
1573853167048 <= {"id":"7013","result":{"assists":[{"message":"Add padding","edits":[{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","fileStamp":0,"edits":[{"offset":3858,"length":4,"replac
1573853167612 => {"id":"7014","method":"analysis.updateContent","params":{"files":{"D:\FlutterProjects\flutter_app\lib\main.dart":{"type":"add","content":"import 'package:flutter/cupertino.dart';
1573853167635 <= {"id":"7014","result":{}}
1573853167659 => {"id":"7015","method":"edit.getAssists","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3861,"length":0},"clientRequestTime":1573853167659}
1573853167690 <= {"event":"analysis.errors","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","errors":[{"severity":"ERROR","type":"STATIC_WARNING","location":{"file":"D:\FlutterPro
1573853167692 <= {"id":"7015","result":{"assists":[]}}
1573853167693 <= {"event":"analysis.highlights","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","regions":[{"type":"DIRECTIVE","offset":0,"length":40},{"type":"BUILT_IN","offset":0
1573853167695 <= {"event":"analysis.navigation","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","regions":[{"offset":7,"length":32,"targets":[0]},{"offset":48,"length":31,"targets"
1573853167695 <= {"event":"analysis.closingLabels","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","labels":[{"offset":309,"length":162,"label":"MaterialApp"},{"offset":998,"length
1573853167696 <= {"event":"analysis.outline","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name":"","locat
1573853167697 <= {"event":"analysis.overrides","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","overrides":[{"offset":268,"length":5,"superclassMember":{"element":{"kind":"METHOD",
1573853167699 <= {"event":"flutter.outline","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","outline":{"kind":"DART_ELEMENT","offset":0,"length":3866,"codeOffset":0,"codeLength":38
1573853167702 <= {"event":"completion.availableSuggestions","params":{"changedLibraries":[{"id":710,"uri":"package:flutter_app/main.dart","items":[{"label":"Page2","declaringLibraryUri":"package:flutt
1573853167702 <= {"event":"analysis.implemented","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","classes":[],"members":[]}}
1573853167997 => {"id":"7016","method":"analysis.updateContent","params":{"files":{"D:\FlutterProjects\flutter_app\lib\main.dart":{"type":"add","content":"import 'package:flutter/cupertino.dart';
1573853168009 <= {"id":"7016","result":{}}
1573853168020 => {"id":"7017","method":"edit.getAssists","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","offset":3856,"length":0},"clientRequestTime":1573853168020}
1573853168031 <= {"event":"analysis.errors","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","errors":[{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"D:\FlutterPr
1573853168031 <= {"event":"analysis.highlights","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","regions":[]}}
1573853168032 <= {"event":"analysis.navigation","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","regions":[],"targets":[],"files":[]}}
1573853168032 <= {"event":"analysis.closingLabels","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","labels":[]}}
1573853168032 <= {"event":"analysis.outline","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name":"","locat
1573853168033 <= {"event":"analysis.overrides","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","overrides":[]}}
1573853168033 <= {"event":"flutter.outline","params":{"file":"D:\FlutterProjects\flutter_app\lib\main.dart","outline":{"kind":"DART_ELEMENT","offset":0,"length":0,"codeOffset":0,"codeLength":0,"da
1573853168043 <= {"event":"server.error","params":{"isFatal":false,"message":"Captured exception","stackTrace":"type 'FunctionExpressionInvocationImpl' is not a subtype of type 'SuperExpression'\n#0

Thanks for reporting this issue! This was previously reported at https://github.com/dart-lang/sdk/issues/37992; please follow along there.

Duplicate of https://github.com/dart-lang/sdk/issues/37992

authors: KarakayaFSM srawlins


text:
Analyzer Feedback from IntelliJ

Analyzer Feedback from IntelliJ
Version information

IDEA AI-191.8026.42.35.5977832
2.5.0-edge.1ef83b86ae637ffe7359173804cbc6d3fa25e6db
AI-191.8026.42.35.5977832, JRE 1.8.0_202-release-1483-b49-5587405x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.14.6, screens 1680x1050, 1920x1080  Retina

Exception
Dart analysis server, SDK version 2.5.0-edge.1ef83b86ae637ffe7359173804cbc6d3fa25e6db, server version 1.27.2, error: Analysis failed: /Users/peter.chinzorig/projects/ard.digitalbank/Flutter/digitalbank/lib/plugin/mp_chart/lib/mp/core/data_set/scatter_data_set.dart context: exception_20191118_172033_948
NoSuchMethodError: The method 'withNullability' was called on null.
Receiver: null
Tried calling: withNullability(Instance of 'NullabilitySuffix')
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      InterfaceLeastUpperBoundHelper.compute (package:analyzer/src/generated/type_system.dart:2066:19)
#2      Dart2TypeSystem._interfaceLeastUpperBound (package:analyzer/src/generated/type_system.dart:987:19)
#3      TypeSystem.getLeastUpperBound (package:analyzer/src/generated/type_system.dart:2405:14)
#4      InferenceContext.addReturnOrYieldType (package:analyzer/src/generated/resolver.dart:2549:28)
#5      ResolverVisitor.visitReturnStatement (package:analyzer/src/generated/resolver.dart:4334:24)
#6      ReturnStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:8634:49)
#7      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7670:20)
#8      ScopedVisitor.visitSwitchCase (package:analyzer/src/generated/resolver.dart:5732:23)
#9      ResolverVisitor.visitSwitchCase (package:analyzer/src/generated/resolver.dart:4431:11)
#10     SwitchCaseImpl.accept (package:analyzer/src/dart/ast/ast.dart:9548:49)
#11     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7670:20)
#12     ResolverVisitor.visitSwitchStatementInScope (package:analyzer/src/generated/resolver.dart:4469:22)
#13     ScopedVisitor.visitSwitchStatement (package:analyzer/src/generated/resolver.dart:5763:7)
#14     SwitchStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:9704:49)
#15     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7670:20)
#16     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1115:17)
#17     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4258:10)
#18     UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3128:31)
#19     ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:5171:13)
#20     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1111:49)
#21     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1070:13)
#22     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4258:10)
#23     UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3131:55)
#24     ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:5182:13)
#25     ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:3508:13)
#26     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1066:49)
#27     MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7110:12)
#28     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4258:10)
#29     UnifyingAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:3336:55)
#30     ScopedVisitor.visitMethodDeclarationInScope (package:analyzer/src/generated/resolver.dart:5669:11)
#31     ResolverVisitor.visitMethodDeclarationInScope (package:analyzer/src/generated/resolver.dart:4207:11)
#32     ScopedVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:5662:7)
#33     ResolverVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:4198:13)
#34     MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7101:49)
#35     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7670:20)
#36     ScopedVisitor.visitClassMembersInScope (package:analyzer/src/generated/resolver.dart:5248:18)
#37     ScopedVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:5226:11)
#38     ResolverVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:3552:13)
#39     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1554:49)
#40     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:3594:23)
#41     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2140:49)
#42     LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:698:10)
#43     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:162:7)
#44     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#45     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:161:11)
#46     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:115:14)
#47     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#48     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:114:43)
#49     AnalysisDriver._computeAnalysisResult.<anonymous closur...

For additional log information, please append the contents of
file:///private/var/folders/8q/82ck4q856j7dnq1syvp563_40000gp/T/report1.txt.

Thanks for reporting this issue! This was previously reported at https://github.com/dart-lang/sdk/issues/38589; please follow along there.

Duplicate of https://github.com/dart-lang/sdk/issues/38589

authors: cgdzin srawlins


text:
Getting problem in creating new project

Analyzer Feedback from IntelliJ
Version information

IDEA AI-191.8026.42.35.6010548
2.3.0-edge.a1668566e563aef64025d0af88a099cbbe847b7e
AI-191.8026.42.35.6010548, JRE 1.8.0_202-release-1483-b03x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1366x768

Exception
Dart analysis server, SDK version 2.3.0-edge.a1668566e563aef64025d0af88a099cbbe847b7e, server version 1.26.0, error: Analysis failed: C:\Users\Dell\AndroidStudioProjects\gold_app\lib\main.dart context: exception_20191209_132834_051
FileSystemException: Exists failed, path = 'C:\Users\Dell\AndroidStudioProjects\gold_app\lib\READONLY' (OS Error: Access is denied.
, errno = 5)
#0      _Directory.existsSync (dart:io/directory_impl.dart:99:7)
#1      _PhysicalResource.exists (package:analyzer/file_system/physical_file_system.dart:369:29)
#2      _OverlayFolder.exists (package:analyzer/file_system/overlay_file_system.dart:284:32)
#3      BazelWorkspace.find (package:analyzer/src/workspace/bazel.dart:312:26)
#4      ContextBuilder.createWorkspace (package:analyzer/src/context/builder.dart:678:42)
#5      new BestPracticesVerifier (package:analyzer/src/generated/resolver.dart:316:24)
#6      LibraryAnalyzer._computeHints (package:analyzer/src/dart/analysis/library_analyzer.dart:249:21)
#7      LibraryAnalyzer.analyzeSync.<anonymous closure>.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:166:11)
#8      __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:367:8)
#9      LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:165:15)
#10     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#11     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:151:35)
#12     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:102:14)
#13     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#14     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:101:43)
#15     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1450:63)
#16     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#17     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1427:20)
#18     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1227:17)
<asynchronous suspension>
#19     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2160:24)
<asynchronous suspension>
#20     AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:2090:5)
#21     new AnalysisServer (package:analysis_server/src/analysis_server.dart:210:29)
#22     SocketServer.createAnalysisServer (package:analysis_server/src/socket_server.dart:86:26)
#23     StdioAnalysisServer.serveStdio (package:analysis_server/src/server/stdio_server.dart:37:18)
#24     Driver.startAnalysisServer.<anonymous closure> (package:analysis_server/src/server/driver.dart:508:21)
#25     _rootRun (dart:async/zone.dart:1124:13)
#26     _CustomZone.run (dart:async/zone.dart:1021:19)
#27     _runZoned (dart:async/zone.dart:1516:10)
#28     runZoned (dart:async/zone.dart:1463:12)
#29     Driver._captureExceptions (package:analysis_server/src/server/driver.dart:591:12)
#30     Driver.startAnalysisServer (package:analysis_server/src/server/driver.dart:506:7)
#31     Driver.start (package:analysis_server/src/server/driver.dart:411:7)
#32     main (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/analysis_server/bin/server.dart:12:11)
#33     _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#34     main (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/analysis_server/bin/server.dart:10:10)
#35     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:298:32)
#36     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

For additional log information, please append the contents of
file://C:\Users\Dell\AppData\Local\Temp\report.txt.

Dart 2.3.0 was released over 6 months ago; please upgrade Dart (or Flutter) to a recent version. Feel free to re-open this issue if it occurs again.


text:
Please merge 05e43cff921c23cdf52558538ecf84d8091d3cdb into dev channel

commit(s) to merge: 05e43cff921c23cdf52558538ecf84d8091d3cdb
merge instructions: clean merge
reason: Reverted change was breaking Brew installations of the Dart SDK on MacOS. See https://github.com/dart-lang/sdk/issues/41329
/cc @dgrove @kevmoo @mit-mit @whesse @athomas

FYI the dev channel is broken now, so I'd love to have this in the dev channel AND beta channel

This should also merge to beta branch.

Removed Merge-to-beta and Merge-to-dev labels.  The label should applied to the original bug #41329

Merged this to beta in 2.8.0-dev.20.7 even though there is a newer fix on master (to ensure that beta isn't broken on HEAD).

authors: athomas bkonyi franklinyow kevmoo


text:
Dart2js release build may make generic parameters dynamic

From https://github.com/rrousselGit/provider/issues/406
@mono0926 found a compilation issue with Dart2js when running:
flutter run -t chrome --release

where the build output behaves differently from debug builds and VM builds.
The issue happens with the following code:
typedef Locator = void Function<T>();

class Bar {
  Bar({this.read}) {
    read<int>();
  }

  final Locator read;
}

void main() {
  Bar(read: <T>() {
    print(T);
    return null;
  });
}

The expected behavior of this code is to print int in the console, which it does in debug builds and VM release builds.
But when running this code with flutter -t chrome --release, this will print dynamic
This causes InheritedWIdgets from Flutter to fail to be resolved

This was tested on the up-to-date master channel of Flutter (1.18.0-5.0.pre-57), which uses Dart  2.8.0-dev.20.0

fyi - @rakudrama @fishythefish

Hmm, looks like we're discarding the type argument in the backend somewhere:
V.main_closure.prototype = {
  call$1$0: function($T) {
    H.printString(H.createRuntimeType($T).toString$0(0));
  },
  call$0: function() {
    return this.call$1$0(type$.dynamic);
  },
  $signature: 0
};

This is the case even if the Bar constructor is simply Bar(this.read); and main itself invokes .read<int>(), but the problem vanishes if the Locator is a local instead of a member.

At the very beginning the SSA code is missing the type argument.
With the command-line option --disable-rti-optimization, it prints int.
The type is probably being dropped on the basis of some 'rti-need' bug.

This bug stopps us from release a web app. Is there any workaround other then removing Provider from the whole app?

Taking a deeper look at this now since this is causing NNBD tests to fail.

The fix for this is causing test failures on dartdevc firefox
https://dart-review.googlesource.com/c/sdk/+/151301
introduced failures on firefox:
dartdevk-checked-linux-release-firefox
Pass -> RuntimeError (expected Pass)
✔ language_2/regress/regress22443_test
Timeout -> RuntimeError (expected Pass)
✔ language_2/regress/regress23244_test

@whesse I'm a little confused by that, since this fix only touches pkg/compiler (the dart2js backend, not DDC), and the tests you mentioned don't seem to have anything to do with this issue.
The logs (22443, 23244) are inscrutable to me, so I don't know if this is just flakiness or not. @nshahan, do you know what's going on here?

There are parts of the test infrastructure that get compiled by dart2js and then used to run tests for DDC so it is technically possible for a dart2js only change to break a DDC bot but that should appear to be an infra failure.
These failure logs show DDC stack traces so I'm not sure how your change could be the cause. @whesse Is it possible that they are flakes or did we update the version of firefox running on the bots around the same time this change landed?

I checked on it, by looking in the results.json for the build after the one they were reported on.
They were detected to be flaky in that next build, so they stopped being reported on the results feed, and the previous failure was not marked as "superceded" (inactive, replaced by a more recent change).
This failure has happened a number of times before, and confuses everyone and wastes their time.
The fix is to report a change in flaky status to the results feed, and mark earlier failures on now flaky tests as inactive.
I see now that fixing this is urgent, because it wastes so many users' time when it happens.
https://github.com/dart-lang/dart_ci/issues/98

I'm not sure when this will be available in the beta channel but for those using StateNotifier/Provider/LocatorMixin who need a workaround I was able to solve it by using the following:
  Repository get repository {
    var reader = read;
    return reader();
  }

As this comment mentions, making read a local var seems to resolve the issue.

I'm not sure why this is close as the bug is still happening on the latest version of Dart/Flutter
Dart SDK version: 2.9.0-21.0.dev.flutter-06cb010247 (be) (Tue Jul 7 08:14:51 2020 +0000) on "macos_x64"

My apologies - I closed the issue when my fix landed and our tests started passing, but it looks like there's still another bug lurking around when --omit-implicit-checks is passed. I'll add another test and investigate.

The initial fix for this was pretty quick, but revealed a deeper issue causing other tests (mainly async ones) to fail. I have a more complete fix that I'm working on landing now.

Hello guys, any news on this? This is blocking us from releasing a web app on:
Flutter (Channel master, 1.21.0-10.0.pre.18, on Mac OS X 10.15.6 19G73, locale en-US)
Thanks in advance.

HI @ochmist - the fix landed in https://github.com/dart-lang/sdk/commit/5671730c5ae2e08bf8c0d63bb076fec1930ce868, which is part of Dart's 2.10.0-1.0.dev release and newer releases.
I am not sure on which flutter release this version was rolled into. When I try flutter doctor -v, I see already a newer version of the Dart sdk in the master channel:
[✓] Flutter (Channel master, 1.21.0-10.0.pre.41, on Linux, locale en_US.UTF-8)
    • Flutter version 1.21.0-10.0.pre.41 at /usr/local/google/home/sigmund/dart/flutter/flutter
    • Framework revision 49fac9a885 (2 days ago), 2020-08-11 11:44:03 -0700
    • Engine revision 9b4ce4e3a0
    • Dart version 2.10.0 (build 2.10.0-11.0.dev)

So the fix should be there. Is the Dart version in your case further behind? Is this resolved after upgrading to the latest flutter?

Hi @sigmundch, Confirmed that this works well after flutter upgrade. Thank you very much.

@ochmist what flutter version is working for you? We are also using StateNotifier and our web app is crashing due to this bug.Thanks!

Actually, after the upgrade it ended up working for a while but breaking soon after. I noticed that once of my dependencies was still outdated and the crash was happening in there.

To clarify, do you have a repro that still fails with the latest SDK, or is this just a toolchain issue?

I tried flutter web + riverpod.
This code doesn't work.
final xxxxProvider = StateNotifierProvider.autoDispose.family<FooController, Bar>((ref, foo) {

Then, I built without minify. https://stackoverflow.com/questions/59710360
flutter build web --profile --dart-define=Dart2jsOptimization=O0

I can see this log in chrome console.
Uncaught TypeError: Instance of 'AutoDisposeProviderElement<StateNotifier<dynamic>, StateNotifier<dynamic>>': type 'AutoDisposeProviderElement<StateNotifier<dynamic>, StateNotifier<dynamic>>' is not a subtype of type 'ProviderElement<Object, FooController>'

But this workaround saved me.
https://github.com/rrousselGit/river_pod/commit/5d6d1b1f74277a1609a2858459e0fdb7ca8a1723#diff-d98faf2ba46cc2fa0f6e56d1bf216afe6b380aabc34ba3b4f74ae7d83cecb52fR36
final $family = StateNotifierProvider.autoDispose.family;
final xxxxProvider = $family<FooController, Bar>((ref, foo) {

@fishythefish Can you confirm that this is fixed in the latest SDK?
Seems like it is not (from what @ochmist & @takeru reported). Also, we are still experiencing this issue as well.

@fishythefish Can you confirm that this is fixed in the latest SDK?
Seems like it is not (from what @ochmist & @takeru reported). Also, we are still experiencing this issue as well.

(still happens in 2.12.0-133.2.beta)

(still happens in 2.12.0-133.2.beta)

@creativecreatorormaybenot Sorry, I missed this notification earlier. I can't reproduce this issue in the latest SDK when I compile the original example. Do you have a different minimal repro that continues to fail? (I don't work on flutter, so the less flutter-specific, the easier it is for me.)

@creativecreatorormaybenot Sorry, I missed this notification earlier. I can't reproduce this issue in the latest SDK when I compile the original example. Do you have a different minimal repro that continues to fail? (I don't work on flutter, so the less flutter-specific, the easier it is for me.)

@fishythefish Using riverpod (Dart library):
final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

class Foo extends StateNotifier<int> {
  Foo(): super(0);
}

class Params {}

void main() {
  final container = ProviderContainer();

  container.ref.watch(providerFamily); // crashes
}

Fixed by:
final _family = StateNotifierProvider.autoDispose.family;
final providerFamily =
    _family<Foo, Params>((ref, params) {
  return Foo();
});

// ...

I do not have the time to test it right now. This is a simplified version of what we have in our app, so if the bug depends on some kind of edge case, it might not reproduce it, however, I think it should do so. Let me know if you have any problems reproducing the bug, then I will get back to you later with a fully tested one - I simply wanted to shoot this one at you in order to help asap.

@fishythefish Using riverpod (Dart library):
final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

class Foo extends StateNotifier<int> {
  Foo(): super(0);
}

class Params {}

void main() {
  final container = ProviderContainer();

  container.ref.watch(providerFamily); // crashes
}

Fixed by:
final _family = StateNotifierProvider.autoDispose.family;
final providerFamily =
    _family<Foo, Params>((ref, params) {
  return Foo();
});

// ...

I do not have the time to test it right now. This is a simplified version of what we have in our app, so if the bug depends on some kind of edge case, it might not reproduce it, however, I think it should do so. Let me know if you have any problems reproducing the bug, then I will get back to you later with a fully tested one - I simply wanted to shoot this one at you in order to help asap.

container doesn't have a ref getter, so I can't compile this code.

container doesn't have a ref getter, so I can't compile this code.

container.listen(provider) should crash
Alternatively you can do:
final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

final refProvider = Provider((ref) => ref);

void main() {
  final container = ProviderContainer();

  final ref = container.read(refProvider);

 ref.watch(providerFamily);
}

which should crash too

container.listen(provider) should crash
Alternatively you can do:
final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

final refProvider = Provider((ref) => ref);

void main() {
  final container = ProviderContainer();

  final ref = container.read(refProvider);

 ref.watch(providerFamily);
}

which should crash too

Both your examples seem to be unrelated to this issue - I'm getting a compile-time type error in each case, not a runtime error or crash due to dart2js. (Both the common front-end to the compiler and dart analyzer report this).

Both your examples seem to be unrelated to this issue - I'm getting a compile-time type error in each case, not a runtime error or crash due to dart2js. (Both the common front-end to the compiler and dart analyzer report this).

@fishythefish Sorry for posting the code prior to testing it - I thought it would be helpful and that the concept would be enough. Here are the full steps for reproducing the bug:

Dart SDK version: 2.12.0-133.2.beta (beta)
dart create -t web-simple bug
Add a riverpod: 0.12.1 dependency
Edit web/main.dart to be the following:

import 'package:riverpod/riverpod.dart';

final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

class Foo extends StateNotifier<int> {
  Foo(): super(0);
}

class Params {}

void main() {
  final container = ProviderContainer();
  container.listen(providerFamily(Params())); // crashes in dart2js only
  print('console.log');
}

webdev serve & run on localhost - succeeds ("console.log" in the JS console in dev tools)
webdev build & cd build & http-server & run on localhost - fails (error in the JS console)

Uncaught Error: undefined
    a http://localhost:8080/main.dart.js:141
    dI http://localhost:8080/main.dart.js:533
    f_ http://localhost:8080/main.dart.js:532
    f1 http://localhost:8080/main.dart.js:507
    $2$1 http://localhost:8080/main.dart.js:2649
    $1 http://localhost:8080/main.dart.js:2650
    b9 http://localhost:8080/main.dart.js:2644
    <anonymous> http://localhost:8080/main.dart.js:3016
    c http://localhost:8080/main.dart.js:27
    dY http://localhost:8080/main.dart.js:1638
    <anonymous> http://localhost:8080/main.dart.js:3025
    <anonymous> http://localhost:8080/main.dart.js:3020
    dartProgram http://localhost:8080/main.dart.js:3023
    <anonymous> http://localhost:8080/main.dart.js:3025
main.dart.js:141:3

@fishythefish Sorry for posting the code prior to testing it - I thought it would be helpful and that the concept would be enough. Here are the full steps for reproducing the bug:

Dart SDK version: 2.12.0-133.2.beta (beta)
dart create -t web-simple bug
Add a riverpod: 0.12.1 dependency
Edit web/main.dart to be the following:

import 'package:riverpod/riverpod.dart';

final providerFamily = StateNotifierProvider.autoDispose.family<Foo, Params>((ref, params) {
  return Foo();
});

class Foo extends StateNotifier<int> {
  Foo(): super(0);
}

class Params {}

void main() {
  final container = ProviderContainer();
  container.listen(providerFamily(Params())); // crashes in dart2js only
  print('console.log');
}

webdev serve & run on localhost - succeeds ("console.log" in the JS console in dev tools)
webdev build & cd build & http-server & run on localhost - fails (error in the JS console)

Uncaught Error: undefined
    a http://localhost:8080/main.dart.js:141
    dI http://localhost:8080/main.dart.js:533
    f_ http://localhost:8080/main.dart.js:532
    f1 http://localhost:8080/main.dart.js:507
    $2$1 http://localhost:8080/main.dart.js:2649
    $1 http://localhost:8080/main.dart.js:2650
    b9 http://localhost:8080/main.dart.js:2644
    <anonymous> http://localhost:8080/main.dart.js:3016
    c http://localhost:8080/main.dart.js:27
    dY http://localhost:8080/main.dart.js:1638
    <anonymous> http://localhost:8080/main.dart.js:3025
    <anonymous> http://localhost:8080/main.dart.js:3020
    dartProgram http://localhost:8080/main.dart.js:3023
    <anonymous> http://localhost:8080/main.dart.js:3025
main.dart.js:141:3

Thanks for your patience, @creativecreatorormaybenot. It does look like we're performing an incorrect RTI optimization somewhere and erasing needed type variables. I'm reopening the issue and will investigate when I get a chance.

Thanks for your patience, @creativecreatorormaybenot. It does look like we're performing an incorrect RTI optimization somewhere and erasing needed type variables. I'm reopening the issue and will investigate when I get a chance.

Turns out it was the same issue as before with essentially the same fix, but dart2js needed to do some additional work to properly track call methods. The fix is landed in the SDK, although I'm not sure when it'll roll into Flutter. Please let me know if you continue to see this bug arise.

@fishythefish just upgraded from flutter 2.0.2 to 2.2.1 and am still getting the same error.

@fishythefish thanks for resolving this. How do I get the fix? If I set my Dart version constraints to >= 2.13 would that resolve it?

@venkatd Yes, 2.13 should have all the fixes in it. On the Flutter side, I believe this means 2.2 or higher should have the fix as well.

authors: creativecreatorormaybenot enyo fishythefish matthewtsmith nshahan ochmist rakudrama rrousselGit sigmundch sma takeru venkatd vsmenon whesse


text:
[CP] Merge 90bba3ae277da into beta - avoids future issues with accidentally running incompatible kernel files on VM

Commit(s) to merge: 90bba3ae277da
Merge instructions: clean merge
What's the problem:
For many years the VM only validated the kernel format version of kernel files it was given. Though the kernel format version is not updated on various non-format changes. This can cause the VM to seemingly accept kernel files that are incompatible.
This manifests in pub run / flutter packages pub run using a cached kernel file to run on the VM. The VM can misbehave, throw exceptions or could even crash.
To avoid this going forward, we embed the dart-lang/sdk commit hash into kernel files produced and verify when consuming them, therefore avoiding the VM accepting non-compatible kernel files.
There was one missing piece for this which is not in the beta branch, which we'd like to cherry-pick.
See also https://github.com/dart-lang/sdk/issues/41802 for more information.
Why cherry-pick:
To ensure future releases of Dart SDK no longer have issues like these:

https://github.com/dart-lang/build/issues/2748
https://github.com/dart-lang/build/issues/2738
https://github.com/flutter/flutter/issues/59245

/cc @kevmoo @mit-mit @whesse @athomas @a-siva  @franklinyow

We're getting late into cherry-pick season and this isn't a regression.
@mkustermann - do you consider this low risk?  Has it rolled into flutter and/or internal successfully?
@kevmoo - how important is this to get into the current beta?  ( fyi - @jonahwilliams @natebosch )

We're getting a BUNCH of failures in CI without this fix. This is with any
precompiled binaries (pkg test, build runner, etc)
This is a regression that's hard to debug unless you have context.
Nake/Jake would be good to discuss risk with, too – although Martin has
most of the context, I think.
On Mon, Jul 20, 2020 at 5:47 AM vsmenon notifications@github.com wrote:

We're getting late into cherry-pick season and this isn't a regression.
@mkustermann https://github.com/mkustermann - do you consider this low
risk? Has it rolled into flutter and/or internal successfully?
@kevmoo https://github.com/kevmoo - how important is this to get into
the current beta? ( fyi - @jonahwilliams
https://github.com/jonahwilliams @natebosch
https://github.com/natebosch )
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/sdk/issues/42741#issuecomment-661015576,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAEFCS2GBRDALWB5Y63C53R4Q4HHANCNFSM4O6AI46Q
.

and this isn't a regression.

This is a regression. Old SDKs do not have this problem.

Thanks for the clarifications!  lgtm

Cherry-picked to 2.9.0-21.10.beta.

authors: kevmoo mkustermann natebosch vsmenon whesse


text:
[dart2js] Failure on  kernel/unsorted/super_mixin_test

There are new test failures on [gardening] Mark regression test slow.
The tests
kernel/unsorted/super_mixin_test Crash (expected Pass)

are failing on configurations
dart2js-hostasserts-linux-ia32-d8

This test uses super calls in a mixin. These are supposed to be rewritten by cloning by the CFE.
--- Command "dart2js" (took 03.000965s):
DART_CONFIGURATION=ReleaseIA32 sdk/bin/dart2js_developer --test-mode --packages=/b/s/w/ir/.packages /b/s/w/ir/tests/kernel/unsorted/super_mixin_test.dart --out=/b/s/w/ir/out/ReleaseIA32/generated_compilations/dart2js/tests_kernel_unsorted_super_mixin_test/super_mixin_test.js

exit code:
253

stderr:
Unhandled exception:
Assertion failure: No Class for has been created for superclass j:class(BaseMixin) of Class(name=Mixin,element=j:class(Mixin)).
#0      failedAt (package:compiler/src/diagnostics/invariant.dart:49:3)
#1      ProgramBuilder.buildProgram.<anonymous closure> (package:compiler/src/js_emitter/program_builder/program_builder.dart:220:13)
#2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#3      ProgramBuilder.buildProgram (package:compiler/src/js_emitter/program_builder/program_builder.dart:214:14)
#4      EmitterImpl.emitProgram.<anonymous closure> (package:compiler/src/js_emitter/startup_emitter/emitter.dart:193:29)
#5      CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:179:35)
#6      EmitterImpl.emitProgram (package:compiler/src/js_emitter/startup_emitter/emitter.dart:192:29)
#7      CodeEmitterTask.assembleProgram.<anonymous closure> (package:compiler/src/js_emitter/code_emitter_task.dart:147:26)
#8      CompilerTask.measure (package:compiler/src/common/tasks.dart:64:51)
#9      CodeEmitterTask.assembleProgram (package:compiler/src/js_emitter/code_emitter_task.dart:117:12)
#10     JsBackendStrategy.assembleProgram (package:compiler/src/js_model/js_strategy.dart:359:35)
#11     Compiler.runCodegenEnqueuer (package:compiler/src/compiler.dart:396:39)
#12     Compiler.generateJavaScriptCode (package:compiler/src/compiler.dart:290:9)
#13     Compiler.compileFromKernel.<anonymous closure> (package:compiler/src/compiler.dart:438:9)
#14     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:179:35)
#15     Compiler.compileFromKernel (package:compiler/src/compiler.dart:411:14)
#16     Compiler.runInternal (package:compiler/src/compiler.dart:263:13)
<asynchronous suspension>
#17     Compiler.run.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:218:38)
#18     new Future.sync (dart:async/future.dart:223:31)
#19     Compiler.run.<anonymous closure> (package:compiler/src/compiler.dart:218:20)
#20     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:179:35)
#21     Compiler.run (package:compiler/src/compiler.dart:215:41)
#22     CompilerImpl.run.<anonymous closure>.<anonymous closure> (package:compiler/src/apiimpl.dart:91:22)
#23     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#24     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#25     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#26     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#27     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#28     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#29     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#30     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#31     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#32     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

--- Re-run this test:
python tools/test.py -n dart2js-hostasserts-linux-ia32-d8 --dart2js-batch kernel/unsorted/super_mixin_test

Closed by 9206b6cabbc56e4c0861d7641c6bdc68542368bb.

authors: fishythefish rakudrama


text:
Flutter Web Workder: Uncaught TypeError: J.getInterceptor$ax(...).get$iterator is not a function

Summary
I am using a web worker in a Flutter app to crop and resize an image. The web worker works fine in debug mode but not in profile or release mode.

I have a worker.dart file that contains the relevant code
I run dart2js -o worker.js worker.dart to generate a worker.js file
worker.dart sends back "computedPieces", which is a List<Uint8List> type

The issue shows up when I try to use "computedPieces" on the Flutter side.
Debug Mode: The runtimeType of "computedPieces" in Flutter is List<dynamic>
Profile/Release Mode: The runtimeType of "computedPieces" in Flutter is JsonArray<dynamic>
Reproducing the Issue
I discovered this while building my submission to the Flutter Puzzle Hack. You can see and run my code in this repo.

Clone the repo
Run the project in a chrome browser
Select "Choose Image" and select any .jpg or .png file
Select "Start"

When "Start" is pressed, the web worker is used to process the selected image. In debug mode, you won't see any errors and the image will be sliced into 9 pieces (8 of which will appear in the puzzle). In profile/release mode, the spinner will remain on screen and if you right-click -> inspect -> console, you'll see the following error:
Uncaught TypeError: J.getInterceptor$ax(...).get$iterator is not a function
    at Object.get$iterator$ax (main.dart.js:40858:44)
    at Object.List_List$from (core_patch.dart:418:5)
    at HomeView_build____closure.call$1 (home_view.dart:216:123)
    at MappedListIterable.elementAt$1 (iterable.dart:413:31)
    at ListIterator.moveNext$0 (iterable.dart:342:5)
    at Object.List_List$_of (core_patch.dart:446:5)
    at Object.List_List$of (core_patch.dart:427:39)
    at MappedListIterable.toList$1$growable (iterable.dart:213:44)
    at MappedListIterable.toList$0 (iterable.dart:213:11)
    at HomeView_build___closure0.call$1 (home_view.dart:216:143)

I dug a little deeper and the issue seems to be something different.
In Debug mode, the web worker returns an actual List<Uint8List>.
In Profile/Release mode, postMessage returns an array [[Image_bytes], 3, error, TypeError: t is not a function]
This is causing the error from my first message. Now the question is why doesn't the web worker work in profile/release mode?

@jtmuller5 Thanks for the issue report. Based on what you described and a discussion with @sigmundch it sounds like one possibility is that dart2js is tree shaking away some type information in the presence of the web worker.
I see some code commented out, can you clarify that uncommenting these lines is required for the rerpo?
From your follow up message it sounds like the values being serialized in the message returned from the worker are not valid. I wanted to investigate it a little and I found that if I recompile the worker with a dart2js version: 2.17.0-150.0.dev it seems to work fine in release mode. It is possible this issue has already been fixed but I would like you to confirm? Could you try switching to the Flutter master channel and rebuild the worker with dart2js and then run your app?


text:
type 'int' is not a subtype of type 'double?'

This usually happens when an API response or data processing step returns an int value, but my model or function is expecting a double?.
When a double variable is assigned an int value, implicit conversion from int to double is possible. However, the mentioned error occurs in this case.

I'm experiencing the same problem. Can you suggest a solution?

Dart[^1] does not implicitly coerce int to double (or vice versa), because (among other reasons) such conversions are not loss-less. You have to explicitly convert using num.toDouble() or num.toInt().
[^1]: With the exception of JavaScript backend (dart2js) which uses JavaScript numbers to represent both int and double.

authors: dhilshana jasimrazi mraleph


text:
FAILED: CMakeFiles/native-lib.dir/native-lib.c.o

Solved

Hi, How did you solve this

Solved

Hi, How did you solve this.

authors: Karthik-hb benjyguitar

repo: darvincisec/DetectFrida

license: MIT


text:
Speedup MakeCollateralAmounts by skiping denominated inputs early

In wallets with huge number on inputs we can significantly increase the speed of MakeCollateralAmounts by skipping denominated inputs early when we ask to use non-denoms only.

utACK

utACK

utACK

source: gharchive/pull-request

authors: UdjinM6 gladcow the-schnibble willwray

repo: dashpay/dash

license: mit

license_source: bigquery


text:
build: add dask[dataframe] for test deps

As per https://github.com/dask-contrib/dask-awkward/pull/483#issuecomment-1994730138

Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.01%. Comparing base (8cb8994) to head (09f09e7).
Report is 46 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #485      +/-   ##
==========================================
- Coverage   93.06%   93.01%   -0.06%
==========================================
  Files          23       23
  Lines        3290     3322      +32
==========================================
+ Hits         3062     3090      +28
- Misses        228      232       +4

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

authors: codecov-commenter veprbl

repo: dask-contrib/dask-awkward


text:
Remove some pandas compat code

With our pandas min version bumped to 1.4, we should be safe to remove some compatibility code meant for pandas>=1.0,<1.2.

Codecov Report

Merging #1132 (ad9ae1c) into main (e68817f) will decrease coverage by 0.18%.
The diff coverage is n/a.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
@@            Coverage Diff             @@
##             main    #1132      +/-   ##
==========================================
- Coverage   81.57%   81.39%   -0.18%
==========================================
  Files          78       78
  Lines        4390     4387       -3
  Branches      794      794
==========================================
- Hits         3581     3571      -10
- Misses        635      636       +1
- Partials      174      180       +6

Impacted Files
Coverage Δ

dask_sql/_compat.py
100.00% <ø> (ø)

dask_sql/mappings.py
86.60% <ø> (-0.12%)
:arrow_down:

... and 2 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

authors: charlesbluca codecov-commenter

repo: dask-contrib/dask-sql


text:
map_blocks errors with numpy 1.26.0

map_blocks raises an attribute error when used with numpy 1.26
Minimal Complete Verifiable Example:
import dask.array as da

x = da.arange(6, chunks=3)
x.map_blocks(lambda x: x * 2).compute()

Which results in:
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

np.object isn't used though: np.object_ is used twice in array.core:
https://github.com/dask/dask/blob/5d75a04132d5ea1535287a649310c8529dbb3a79/dask/array/core.py#L901
https://github.com/dask/dask/blob/5d75a04132d5ea1535287a649310c8529dbb3a79/dask/array/core.py#L979
So I'm a little confused about why it's erroring here.
For what it's worth, writing dtype=object instead seems to work fine for me locally.

Hi, thanks for your report.
Your reproducer works for me without raising
I am on NumPy 1.26
numpy                     1.26.0          py311hb8f3215_0    conda-forge

Which Dask version are you on? I am on main

authors: Huite phofl

repo: dask/dask


text:
NETCDF - Resource temporarily unavailable

I'm trying to use dask to load a NetCDF file from ECMWF*. However, I get a RuntimeError: Resource temporarily unavailable exception thrown when I run this script:
from dask import array as da
from netCDF4 import Dataset

ds = Dataset('_grib2netcdf-atls01-a562cefde8a29a7288fa0b8b7f9413f7-Bbb1Q9.nc')
a = da.from_array(ds.variables['swh'], chunks=(50, 50, 50))
r = a.mean().compute()
ds.close()

I've tried googling around but not been successful in finding a solution.
I'm using netCDF4 1.2.9 and dask 0.15.2.
Here's the stack trace:
Traceback (most recent call last):
  File "/path/to/file.py", line 7, in <module>
    r = a.mean().compute()
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/base.py", line 99, in compute
Error 11: Resource temporarily unavailable
Error 11: Resource temporarily unavailable
Error 11: Resource temporarily unavailable
    (result,) = compute(self, traverse=False, **kwargs)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/base.py", line 206, in compute
    results = get(dsk, keys, **kwargs)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/threaded.py", line 75, in get
    pack_exception=pack_exception, **kwargs)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/local.py", line 521, in get_async
    raise_exception(exc, tb)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/compatibility.py", line 60, in reraise
    raise exc
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/local.py", line 290, in execute_task
    result = _execute_task(task, data)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/local.py", line 271, in _execute_task
    return func(*args2)
  File "~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dask/array/core.py", line 54, in getter
    c = a[b]
  File "netCDF4/_netCDF4.pyx", line 3823, in netCDF4._netCDF4.Variable.__getitem__ (netCDF4/_netCDF4.c:40266)
  File "netCDF4/_netCDF4.pyx", line 4649, in netCDF4._netCDF4.Variable._get (netCDF4/_netCDF4.c:52088)
RuntimeError: Resource temporarily unavailable

Looks like a problem with multiple processes/threads accessing the *.nc file simultaneously - but unsure how to go about resolving that - as I assume that would be handled on the library level.
Thanks.

* you do need to make an account to download this file.

Try from_array(..., lock=True) to add a lock into the mix.
You might also want to try the XArray project, which has already thought deeply about many of these issues and uses Dask array internally.

@mrocklin Thanks for the quick response. Feel kind of silly that it was a missing parameter; should have done a better job looking. The XArray project also looks quite nice, so thanks for the suggestion.

authors: jamesstidard mrocklin


text:
Short-cut for rechunking an array into a single chunk along an axis?

Currently this requires writing something like x.rechunk((x.shape[0], ...)) or x.rechunk((1000000,)), which is a little clunky.
Possible alternatives:

Use -1 as an alias for "full dimension size", e.g., x.rechunk((-1,)).
Add a keyword argument, e.g., rechunk(divisions=(1,)) for rechunking into equally sized divisions instead of chunks.

Using an alias makes sense.  Doesn't reshape have similar aliases already?

authors: mrocklin shoyer