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

Fixes #2529. Add test checking wildcard parameter with no default value #2730

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

sgrekhov
Copy link
Contributor

@sgrekhov sgrekhov commented Jun 28, 2024

There were no test checking that f([int _]) {...} is not an error. So, just added a tests checking that it is still an error

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with a single typo.

I'm wondering about the named parameters, though: They will give rise to a compile-time error because named parameters can't have a name that starts with _, no matter whether they're required or optional, and no matter their type.

(The current specification has it here, and the null-safety update dart-lang/language#2605 makes the necessary adjustment that it applies to all named parameters including the required ones).

So you could claim that the named-parameter cases do not test the topic of the description.

Perhaps just mention this somewhere (in the description or in a separate comment), and then omit the named cases?

It is also possible that we actually do get the error about the need for a default value (with several errors in the same location you never know exactly which ones we'll get), but it seems likely to me that the actual error message would be about _ being a bad name, not about the missing default value.

LanguageFeatures/Wildcards/other_declarations_A05_t45.dart Outdated Show resolved Hide resolved
@sgrekhov
Copy link
Contributor Author

Ah, thank you! I forgot that named paremeter started with _ is an error itself. We have appropriate tests, so I simply removed named parameters from this test. PTAL

@sgrekhov sgrekhov requested a review from eernstg June 28, 2024 12:07
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eernstg eernstg merged commit 8139ba7 into dart-lang:master Jun 28, 2024
2 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 8, 2024
2024-07-05 sgrekhov22@gmail.com Fixes dart-lang/co19#2759. Update expected errors positions (dart-lang/co19#2760)
2024-07-05 sgrekhov22@gmail.com Fixes dart-lang/co19#2756. Fix the new roll failures (dart-lang/co19#2758)
2024-07-05 sgrekhov22@gmail.com Fixes dart-lang/co19#2756. Fix the new roll failures (dart-lang/co19#2757)
2024-07-05 sgrekhov22@gmail.com Fixes dart-lang/co19#2754. Fix some of the new roll failures (dart-lang/co19#2755)
2024-07-05 sgrekhov22@gmail.com dart-lang/co19#2559. Add missing `augmented` to operators tests (dart-lang/co19#2753)
2024-07-05 sgrekhov22@gmail.com dart-lang/co19#2559. More augmented expressions tests for operators (dart-lang/co19#2752)
2024-07-04 sgrekhov22@gmail.com dart-lang/co19#2559. Add more test cases for augmented expression (dart-lang/co19#2750)
2024-07-03 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting declarations tests (dart-lang/co19#2565)
2024-07-03 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmented expression tests (dart-lang/co19#2749)
2024-07-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2741. Update expected errors locations in augmenting_types_A07_t10.dart (dart-lang/co19#2747)
2024-07-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2742. Update expected errors locations in augmenting types tests (dart-lang/co19#2748)
2024-07-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2740. Update expected errors locations (dart-lang/co19#2746)
2024-07-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2739. Update expected errors locations (dart-lang/co19#2745)
2024-07-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2734. Fix object identity tests for web platforms (dart-lang/co19#2744)
2024-07-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.6 to 4.1.7 in the github-actions group (dart-lang/co19#2743)
2024-07-01 sgrekhov22@gmail.com Fixes dart-lang/co19#2734. Don't expect nan to be identical on web platforms (dart-lang/co19#2737)
2024-07-01 sgrekhov22@gmail.com dart-lang/co19#2559. Add more test cases for augmented expression (dart-lang/co19#2738)
2024-07-01 sgrekhov22@gmail.com Fixes dart-lang/co19#2732. Add missing implementation of an inherited interface (dart-lang/co19#2735)
2024-07-01 sgrekhov22@gmail.com Fixes dart-lang/co19#2733. Expect errors reported on a merged class (dart-lang/co19#2736)
2024-07-01 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmenting expressions tests (dart-lang/co19#2731)
2024-07-01 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmented expression tests (dart-lang/co19#2723)
2024-06-28 sgrekhov22@gmail.com Fixes dart-lang/co19#2726. Update expected errors positions (dart-lang/co19#2727)
2024-06-28 sgrekhov22@gmail.com Fixes dart-lang/co19#2529. Add test checking wildcard parameter with no default value (dart-lang/co19#2730)
2024-06-28 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmented expression tests (dart-lang/co19#2722)
2024-06-28 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmented expression tests for operators. Part 1 (dart-lang/co19#2724)
2024-06-28 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmented expression tests for operators. Part 2 (dart-lang/co19#2728)

Change-Id: I86f5bc77bce1c539789132606fa806082afbf7c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374682
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
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

Successfully merging this pull request may close these issues.

2 participants