Commit Graph

14 Commits

Author SHA1 Message Date
Doug Gregor
af49a90dde Customize diagnostic text for extra/missing/mislabeled arguments for callee kind
Most of the diagnostics for extra/missing/mislabeled arguments refer
to argument to a "call". Some (but not call) would substitute in
"subscript". None would refer to an argument to a macro expansion
properly.

Rework all of these to refer to the argument in a call, subscript, or
macro expansion as appropriate. Fix up lots of tests that now say
"subscript" instead, and add tests for macro expansions.
2023-01-02 21:22:04 -08:00
Doug Gregor
2395225df7 [Type checker] Improve diagnostics for trailing closures.
The change to the forward-scanning rule regressed some diagnostics,
because we no longer generated the special "trailing closure mismatch"
diagnostic. Reinstate the special-case "trailing closure mismatch"
diagnostic, but this time do so as part of the normal argument
mismatch diagnostics so it is based on type information.

While here, clean up the handling of missing-argument diagnostics to
deal with (multiple) trailing closures properly, so that we can (e.g)
suggest adding a new labeled trailing closure at the end, rather than
producing nonsensical Fix-Its.

And, note that SR-12291 is broken (again) by the forward-scan matching
rules.
2020-07-24 08:10:54 -07:00
Holly Borla
e63f259f4f [ConstraintSystem] Bind holes to UnresolvedType instead of Any. 2019-11-05 09:15:13 -08:00
Pavel Yaskevich
495f14a698 [ConstraintSystem] Use new trailing closure fix in matchCallArguments 2019-11-01 01:20:13 -07:00
Pavel Yaskevich
ec6a874ac8 [TypeChecker] NFC: Update test-cases improved by new missing arguments diagnostic 2019-09-25 10:47:26 -07:00
Greg Titus
f444b4d44b Calls with unexpected trailing closures weren't getting passed on to ArgumentMatcher. 2019-08-05 06:50:44 -07:00
Doug Gregor
a1af0e45cb [Constraint solver] Reject trailing closures matching non-closure-parameters.
Enhance call-argument matching to reject trailing closures that match up
with parameters that cannot accept closures at all.

Fixes rdar://problem/50362170.
2019-04-30 23:12:32 -07:00
Slava Pestov
3701f745c4 Migrate various Sema tests to Swift 4 2018-06-25 01:02:20 -07:00
Slava Pestov
5d2752f7d2 Run tests with -swift-version 4 by default
Some test now fail, so add an explicit -swift-version 3.
2018-06-19 23:24:19 -07:00
Matthew Carroll
4b9dd593d8 [QoI] SR-2475: Warn when an unlabeled parameter follows a variadic parameter
- Add test to verify an error is emitted when calling a function with an unlabeled parameter following a variadic parameter.
- Add test to verify no diagnostic is emitted when calling a function with a labeled parameter following a variadic parameter.
2017-01-16 12:46:40 -05:00
Matthew Carroll
33083f0351 [QoI] SR-2475: Warn when an unlabeled parameter follows a variadic parameter
Add a diagnostic that warns when an unlabeled parameter follows a variadic parameter.
https://bugs.swift.org/browse/SR-2475
2017-01-15 16:34:29 -05:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Rintaro Ishizaki
903242c5fa [Diag] Don't use typed editor placeholder in diagnostics.
Most of command line users are not familiar with <#T##TypeName#> syntax.
2016-11-12 05:00:36 +09:00
Rintaro Ishizaki
5adc3bf804 [QoI] Add fix-it for missing arguments 2016-11-12 04:29:52 +09:00