Skip to content

Weird errors with dart2js and checked mode with functions and Object arguments #28045

@kevmoo

Description

@kevmoo

With dart2js & checked mode, I get the following exception when running the code at the bottom:

Uncaught Error: type 'constructor' is not a subtype of type '(($int, String) -> void) -> void'
    at Object.wrapException (js_helper.dart:1730)
    at RuntimeFunctionType._check$2 (js_helper.dart:3538)
    at RuntimeFunctionType._assertCheck$1 (js_helper.dart:3521)
    at Object.main (game_web.dart:3)
    at iterable.dart:276
    at init.currentScript (iterable.dart:276)
    at iterable.dart:276
    at iterable.dart:276
wrapException @ js_helper.dart:1730
_check$2 @ js_helper.dart:3538
_assertCheck$1 @ js_helper.dart:3521
main @ game_web.dart:3
(anonymous) @ iterable.dart:276
init.currentScript @ iterable.dart:276
(anonymous) @ iterable.dart:276
(anonymous) @ iterable.dart:276
void main() {
  doWeird(oneArgFunc);
  print('works');
  doWeird(oneArgFuncWeird);
  print("don't get here");
}

oneArgFunc(arg) => null;

oneArgFuncWeird(Object arg) => null;

doWeird(OnHijackCallback callback) => null;

typedef void OnHijackCallback(HijackCallback callback);

typedef void HijackCallback(int stream, String sink);

CC @rakudrama

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions