Skip to content

void as Object? into a record throws an exception when run on web #52593

Description

@Hixie

STEPS TO REPRODUCE

  1. flutter create webrecords

  2. Replace webrecords/lib/main.dart with this:

void main() {
  final (Object? b,) = _test1();
  print('PASS');
}

(Object?,) _test1() => (_test2() as Object?,);
void _test2() { }
  1. flutter run -d chrome

EXPECTED RESULTS

$ flutter run -d chrome
flutter run -d chrome
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...             754ms
This app is linked to the debug service: ws://127.0.0.1:36975/-B8nP7yve9w=/ws
Debug service listening on ws://127.0.0.1:36975/-B8nP7yve9w=/ws

🔥  To hot restart changes while running, press "r" or "R".
For a more detailed help message, press "h". To quit, press "q".

A Dart VM Service on Chrome is available at: http://127.0.0.1:36975/-B8nP7yve9w=
PASS

ACTUAL RESULTS

$ flutter run -d chrome
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...             702ms
This app is linked to the debug service: ws://127.0.0.1:36467/o_StX4TLgWc=/ws
Debug service listening on ws://127.0.0.1:36467/o_StX4TLgWc=/ws

🔥  To hot restart changes while running, press "r" or "R".
For a more detailed help message, press "h". To quit, press "q".

A Dart VM Service on Chrome is available at: http://127.0.0.1:36467/o_StX4TLgWc=
Error: NoSuchMethodError: '$1'
method not found
Receiver: Record (null)
Arguments: []
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:49       throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 1061:3   defaultNoSuchMethod
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 64:17                  noSuchMethod
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 1056:31  noSuchMethod
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 169:10   dload
packages/webrecords/main.dart 2:18                                                 t$36$350$351$35func
packages/webrecords/main.dart 2:3                                                  main$
web_entrypoint.dart 24:31                                                          <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 570:37   _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 575:39   dcall
lib/ui/initialization.dart 77:15                                                   <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50                 <fn>
dart-sdk/lib/async/zone.dart 1661:54                                               runUnary
dart-sdk/lib/async/future_impl.dart 156:18                                         handleValue
dart-sdk/lib/async/future_impl.dart 840:44                                         handleValueCallback
dart-sdk/lib/async/future_impl.dart 869:13                                         _propagateToListeners
dart-sdk/lib/async/future_impl.dart 641:5                                          [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 715:7                                          callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                                   _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                                    _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:15                <fn>

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)web-dev-compiler

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions