Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClosureArgumentMismatchException is not defined #881

Closed
efortuna opened this issue Dec 15, 2011 · 2 comments
Closed

ClosureArgumentMismatchException is not defined #881

efortuna opened this issue Dec 15, 2011 · 2 comments

Comments

@efortuna
Copy link
Contributor

Consider the following Dart code:

import('dart:html');

void main() {
  window.setTimeout(() => (new Bar()).foo(), 100);
}
class Bar {
  foo() {
    print('Hello world');
  }
}

The following JavaScript is generated:
function $throwArgMismatch() {
    // TODO(jmesserly): better error message
    $throw(new ClosureArgumentMismatchException());
}

Except "ClosureArgumentMismatchException" is not defined anywhere in the file. Resulting in "Uncaught ReferenceError: ClosureArgumentMismatchException is not defined"

@jmesserly
Copy link

Yeah... the compiler doesn't know that $genStub depends ClosureArgumentMismatchException.
On an unrelated note, we probably want our own subtype of this so we can actually provide an error message. The one in corelib is not so nice...

class ClosureArgumentMismatchException implements Exception {
  const ClosureArgumentMismatchException();
  String toString() => "Closure argument mismatch";
}

@jmesserly
Copy link

Error message isn't great but hopefully more clear now:

Closure argument mismatch: Wrong number of arguments to function. Expected 0 positional arguments and at most 0 named arguments, but got 1 positional arguments and 0 named arguments.


Added Fixed label.

copybara-service bot pushed a commit that referenced this issue Mar 7, 2023
…stack_trace, stream_channel, test, tools, watcher, webdev, yaml, yaml_edit

Revisions updated by `dart tools/rev_sdk_deps.dart`.

async (https://github.com/dart-lang/async/compare/8deaa40..f454380):
  f454380  2023-03-02  Natalie Weizenbaum  Add `StreamExtensions.listenAndBuffer()` (#235)

dartdoc (https://github.com/dart-lang/dartdoc/compare/77d5994..98fa859):
  98fa859c  2023-03-05  dependabot[bot]  Bump cli_util from 0.3.5 to 0.4.0 (#3360)

html (https://github.com/dart-lang/html/compare/0b8025c..08643e9):
  08643e9  2023-03-02  Devon Carew  prep for publishing 0.15.2 (#205)

http (https://github.com/dart-lang/http/compare/1500a71..805a147):
  805a147  2023-03-02  Kevin Moore  Fix some spelling (#884)
  5a2f036  2023-03-02  Kevin Moore  Move to pkg:dart_flutter_team_lints, require Dart 2.19 (#883)
  35b2cef  2023-03-02  Bahaa Fathi Yousef  Corrected the spelling of "Implements" in "/http/lib/src/io_client.dart" (#871)
  bb86cf3  2023-02-27  Brian Quinlan  Provide access to NSURLSession.sessionDescription (#881)

http_multi_server (https://github.com/dart-lang/http_multi_server/compare/2cd5355..7bd190c):
  7bd190c  2023-03-06  Kevin Moore  Require Dart 2.19, enable and fix new team lints (#51)

source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/a60ef54..45ea368):
  45ea368  2023-03-07  Kevin Moore  Require Dart 2.19, use pkg:dart_flutter_team_lints (#35)

stream_channel (https://github.com/dart-lang/stream_channel/compare/0850515..a20ccd4):
  a20ccd4  2023-02-28  Kevin Moore  move to pkg:dart_flutter_team_lints lints, fix code, bump min SDK (#87)

test (https://github.com/dart-lang/test/compare/1307cc5..92da93a):
  92da93a8  2023-03-06  Devon Carew  dogfood the new setup-dart action (#1964)
  e49818ec  2023-03-01  dependabot[bot]  Bump github/codeql-action from 2.2.1 to 2.2.5 (#1963)

tools (https://github.com/dart-lang/tools/compare/28b7be8..a1c3506):
  a1c3506  2023-03-07  Devon Carew  dogfood the new setup-dart action (#25)
  fb46723  2023-03-07  Elias Yishak  Update pubspec.yaml (#24)
  5a72344  2023-03-06  Elias Yishak  Add `DashEvent` for toggling telemetry collection + send event whenever toggled (#23)

watcher (https://github.com/dart-lang/watcher/compare/0ca6638..5968409):
  5968409  2023-03-07  Kevin Moore  blast_repo fixes (#139)
  e8f771a  2023-03-07  Kevin Moore  Require Dart 2.19, use new team lints (#138)

webdev (https://github.com/dart-lang/webdev/compare/deb801b..c007560):
  c007560  2023-03-06  Elliott Brooks (she/her)  [MV3 Debug Extension] Show warning when clicking on debug extension for non Dart app (#2015)
  1a010dc  2023-03-06  Devon Carew  dogfood the new setup-dart action (#2017)
  07743a3  2023-03-06  Anna Gringauze  Fix exception mapping from JS to dart (#2004)
  eb63b31  2023-03-03  Elliott Brooks (she/her)  Create a Dart Debug Extension issue template (#2014)
  85f35d4  2023-03-01  Devon Carew  update publishing automation integration (#2002)
  e748045  2023-02-28  Anna Gringauze  Prepare to release webdev 3.0.1 (#2000)
  5355050  2023-02-27  Elliott Brooks (she/her)  [MV3 Debug Extension] Ignore page reloads for detecting navigation away from app (#1994)
  4e08276  2023-02-27  Anna Gringauze  Prepare to release dwds 18.0.0 (#1993)
  fc54d68  2023-02-27  Anna Gringauze  Fix expression evaluation failures on empty scopes (#1998)
  496a2b4  2023-02-27  Anna Gringauze  Temporarily disable publish verification (#1996)

yaml (https://github.com/dart-lang/yaml/compare/a6d8781..1ad2f49):
  1ad2f49  2023-03-01  Kevin Moore  Require Dart 2.19, migrate to dart_flutter_team_lints, make associated fixes (#138)
  4d369fd  2023-03-01  Kevin Moore  benchmark: fix output.json (#137)

yaml_edit (https://github.com/dart-lang/yaml_edit/compare/998eea2..0668eb5):
  0668eb5  2023-03-02  Jonas Finnemann Jensen  Wrap recursively, prepare release (#28)
  a4ff857  2023-03-01  Mohamed Ishad  Update CHANGELOG.md (#37)
  2fdfbdb  2023-02-28  Mohamed Ishad  Fix for issue #23 (#34)
  494ad7c  2023-02-25  MikiPaul  fixed typo (#36)

Change-Id: I101c94575c20fca55c7440e84668413207073a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287162
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Oct 10, 2023
…t_channel, webdriver

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/524b2b6..5156398):
  5156398c  2023-10-09  Sam Rawlins  Fix sidebar links for pub packages (#3510)
  960bac41  2023-10-09  dependabot[bot]  Bump ossf/scorecard-action from 2.2.0 to 2.3.0 (#3513)
  affc5b44  2023-10-08  Sam Rawlins  Remove some old, unused options (#3511)
  c147aa19  2023-10-06  Sam Rawlins  Fix left sidebar (#3507)

mockito (https://github.com/dart-lang/mockito/compare/49859e4..47a5588):
  47a5588  2023-10-06  Ilya Yanok  Don't try to compare fakes to real objects
  6b9eab9  2023-10-06  Ilya Yanok  Undo the formatting fix
  5ad2ff4  2023-10-05  Ilya Yanok  Change default dummy value for `String` to contain some info
  78c650b  2023-10-05  Ilya Yanok  Use SDK 3.0.0 for stable tests
  adbe265  2023-10-04  Ilya Yanok  Use 3.1.3 as stable SDK

native (https://github.com/dart-lang/native/compare/fd21f5b..22f4481):
  22f4481  2023-10-10  Daco Harkes  [native_assets_builder] Fix pub warning in tests (#155)

protobuf (https://github.com/dart-lang/protobuf/compare/c16bc89..c559fe5):
  c559fe5  2023-10-10  Ömer Sinan Ağacan  Release protoc_plugin-21.1.2 (#881)
  32ed0fe  2023-10-09  Ömer Sinan Ağacan  Fix a bug in comment parsing (#879)

test (https://github.com/dart-lang/test/compare/367aa39..4341470):
  4341470a  2023-10-06  Nate Bosch  Mention integration_test as an ignored directory (#2115)

tools (https://github.com/dart-lang/tools/compare/f318c80..92c5c15):
  92c5c15  2023-10-10  Devon Carew  update to the latest package:dart_flutter_team_lints (#174)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/364013d..f3ac1bf):
  f3ac1bf  2023-10-06  Nate Bosch  Mention `ready` in the docs for `connect` (#287)

webdriver (https://github.com/google/webdriver.dart/compare/21976d6..eaf9c58):
  eaf9c58  2023-10-05  Nate Bosch  Spawn test server in a background isolate (#285)
  ccd01e5  2023-10-05  dependabot[bot]  Bump actions/checkout from 3.6.0 to 4.1.0 (#284)
  f753b3e  2023-10-05  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#283)
  6bd246f  2023-10-05  Devon Carew  require dart 3.0; add publishing automation (#282)

Change-Id: I83ec9986cc8acc60be76267c2d1127f237e2b5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329943
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants