Skip to content

Unhelpful error when using named arguments for non-optional parameters #3189

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

Closed
gramster opened this issue May 23, 2012 · 4 comments
Closed
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug
Milestone

Comments

@gramster
Copy link

I have this code:

void assert_that(arg1, [arg2=null, String arg3='']) {
  if (arg2 is Matcher) {
    _assert_match(actual:arg1, matcher:arg2, reason:arg3);
  } else {
    _assert_bool(assertion:arg1, reason:arg2);
  }
}

void _assert_match(actual, Matcher matcher, String reason) {
...}

When run, it throws an exception on the line where _assert_match is called. The exception is 'StaticResolutionException'.

A much better message would be 'inappropriate use of named arguments' or something similar. It would be better for this to occur before runtime too, so I'm putting it under the static analyzer.

@kasperl
Copy link

kasperl commented May 24, 2012

Added Triaged label.

@bwilkerson
Copy link
Member

Added this to the Later milestone.

@bwilkerson
Copy link
Member

Removed this from the Later milestone.
Added this to the M3 milestone.

@scheglov
Copy link
Contributor

There IS not warning for _assert_match() invocation in Editor/analyzer.


Set owner to @scheglov.
Added AssumedStale label.

@gramster gramster added Type-Enhancement legacy-area-analyzer Use area-devexp instead. closed-obsolete Closed as the reported issue is no longer relevant labels Jan 24, 2013
@gramster gramster added this to the M3 milestone Jan 24, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Oct 29, 2021
Changes:
```
> git log --format="%C(auto) %h %s" 78bc50c..0035a40
 https://dart.googlesource.com/pub.git/+/0035a40f Fix echo mode crash on `token add` (#3194)
 https://dart.googlesource.com/pub.git/+/a75a8c17 Don't warn against discontinued transitive dependencies (#3195)
 https://dart.googlesource.com/pub.git/+/cf2ed105 Fix analytics code (#3197)
 https://dart.googlesource.com/pub.git/+/08e13f7b Remove unused golden files (#3189)
 https://dart.googlesource.com/pub.git/+/b6293b80 Fix log message related to `pub global activate`  (#3187)
 https://dart.googlesource.com/pub.git/+/94f6b477 Introducing command-line interface tests (#3161)
 https://dart.googlesource.com/pub.git/+/3ba8134f More details from getExecutableForCommand (#3186)
 https://dart.googlesource.com/pub.git/+/a2dbcfff Shorthand syntax for hosted dependencies (#3133)
 https://dart.googlesource.com/pub.git/+/435e4e3f Shuffle analytics (#3185)

```

Diff: https://dart.googlesource.com/pub.git/+/78bc50c7833451c24e531713362e46fd50621ff0~..0035a40f25d027130c0314571da53ffafc6d973b/
Change-Id: Idfd7c382985d1ad3e3ad87a621dc79d3b74e898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218620
Reviewed-by: Jonas Jensen <[email protected]>
Commit-Queue: Sigurd Meldgaard <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 27, 2022
…3 revisions)

https://dart.googlesource.com/dartdoc/+log/6b8b1c46da9a..ce5bd271eda9

2022-09-27 [email protected] Fix generic typedef pointing to typedef (#3193)
2022-09-27 [email protected] Unnamed libraries (#3189)
2022-09-27 [email protected] Make InheritingContainer._inheritedElements late final (#3191)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: [email protected]
Change-Id: I371d173b9225721274f4faf652b56ee4f9fa8082
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261461
Commit-Queue: DEPS Autoroller <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
Reviewed-by: Devon Carew <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants