Commit Graph

26 Commits

Author SHA1 Message Date
Anthony Latsis
4f4141fea8 Frontend: Obsolete -fixit-all and -emit-fixits-path
With `ARCMigrate` and `arcmt-test` removed from clang in
https://github.com/llvm/llvm-project/pull/119269 and the new code
migration experience under way (see
https://github.com/swiftlang/swift-evolution/pull/2673), these options
are no longer relevant nor known to be in use. They were introduced
long ago to support fix-it application in Xcode.

For now, turn them into a no-op and emit a obsoletion warning.
2025-05-07 02:30:30 +01:00
Anthony Latsis
2cd90bdd69 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-22 18:23:36 +01:00
Pavel Yaskevich
c922ab5634 [CSBindings] Allow optional subtype inference when closure result is not yet resolved
Similar to `Void?` we need to unwrap `$T?` because it could be later
bound to `Void` from context.

Resolves: rdar://143474313
2025-01-29 13:12:56 -08:00
Pavel Yaskevich
40a41c82d9 [CSBindings] Don't attempt to strip optional for closure result types
Let's not perform $T? -> $T for closure result types to avoid having
to re-discover solutions that differ only in location of optional
injection.

The pattern with such type variables is:

```
$T_body <conv/subtype> $T_result <conv/subtype> $T_contextual_result
```

When `$T_contextual_result` is `Optional<$U>`, the optional injection
can either happen from `$T_body` or from `$T_result` (if `return`
expression is non-optional), if we allow  both the solver would
find two solutions that differ only in location of optional
injection.
2024-12-17 11:36:42 -08:00
Hamish Knight
7971056e21 [Sema] Fold SequenceExpr in pre-checking pre-walk
Doing it in the post-walk meant we ended up
walking the children twice, which lead to duplicate
diagnostics and incorrect inference of the
level of application for function references. Move
it to the pre-walk, ensuring that we resolve any
operator references before folding.
2024-07-29 00:07:45 +01:00
Luciano Almeida
22a18de1b1 [Sema] Improving integer literal as boolean diagnostic 2023-02-21 10:30:48 -03:00
Anthony Latsis
593c6a3887 Merge pull request #60592 from AnthonyLatsis/migrate-test-suite-to-gh-issues-5
Gardening: Migrate test suite to GH issues p. 5
2022-08-20 04:53:48 +03:00
Anthony Latsis
da8d035b0b Gardening: Migrate test suite to GH issues: Constraints (2/5) 2022-08-19 06:43:11 +03:00
Pavel Yaskevich
3fd9037ee9 [ConstraintSystem] Don't produce argument info object for extraneous arguments
An extraneous argument doesn't have a corresponding parameter so the
information object for such an argument is not safe to produce.

Resolves: https://github.com/apple/swift/issues/60436
Resolves: rdar://98304482
2022-08-16 16:22:02 -07:00
Anthony Latsis
16ca1e7871 Add regression test to close #43509 2022-07-09 16:47:55 +03:00
Robert Widmann
174bbd2586 Handle ParamDecls and VarDecls in Argument Matching Diagnostics
These don't produce meaningful ParameterLists for this analysis to
consider. Bail instead of crashing.

rdar://93922410
2022-05-25 16:12:03 -07:00
Hamish Knight
84a2c5c2c1 [Sema] Improve extra trailing closure diagnostic
Emit the specialized extraneous trailing closure
diagnostic for multiple trailing closures and
unlabelled unary argument lists, and add a
specialized trailing closure version for the multiple
extraneous case.
2021-08-02 12:59:43 +01:00
Nathan Hawes
82544451e6 [Sema][CSSimplify] Account for synthesized args when diagnosing labelling issues in matchCallArgumentsImpl
Unfulfilled params get arguments synthesized for them which are added
to the end of the argument list. Later logic to detect out-of-order
arguments and produce relabelling fixes didn't account for them though.
This improves several diagnostics for mislabelled call arguments in the
existing tests.
2021-07-30 14:53:34 +10:00
Alex Hoppen
fa9f3f3337 [Sema] Correctly diagnose passing tuple as only argument to function with multiple parameters
If a tuple is passed as the only argument to a function that takes two unnamed arguments, we try to diagnose the missing argument label. However, in the old diagnose code we didn’t distinguish between non-existing arguments and arguments without labels; both behaved the same.

Thus, the missing second argument in the function call would line up with the empty second argument label, not producing a diagnostic, but hitting an assertion later on.

Distinguish between the two to fix the issue.

Fixes rdar://64319340
2021-03-19 12:58:17 +01:00
Pavel Yaskevich
e086896f24 [Diagnostics] Avoid adding comma when reordering with last argument 2021-01-19 13:37:43 -08:00
Pavel Yaskevich
09f3461e3d [Diagnostics] Adjust OoO fix-it intervals to account for replacement of first argument
Current logic fix-it didn't account for the first argument being re-ordered.
The start position for the first argument should always be the next token
after left paren denoting a start of the argument list.

Resolves: rdar://problem/70764991
2021-01-19 13:37:32 -08:00
Owen Voorhees
9708247065 [SE-0284] Lift the 1-vararg-per-function restriction
[SE-0284] Add round_trip_parse_gen tests

[SE-0284] Add missing test cases
2020-08-23 21:37:07 -07: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
Luciano Almeida
12c8630f7f [tests] Adding regression tests for SR-13240 2020-07-23 20:04:55 -03:00
Pavel Yaskevich
739ba4bb39 [CSBindings] Open collection binding associated with @autoclosure argument
To preserve subtype relationship between element types of a collection
passed as an argument to a parameter represented by another collection
type let's extend opening of the collection types to be done for arguments
to @autoclosure parameters as well because implicit closure is transparent
to the caller.

Resolves: [SR-13135](https://bugs.swift.org/browse/SR-13135)
Resolves: rdar://problem/65088975
2020-07-06 11:54:39 -07:00
Pavel Yaskevich
c0840fdcd3 [TypeChecker] NFC: Restore test-cases removed by incorrect merge 2020-06-12 15:07:32 -07:00
Pavel Yaskevich
d9594c712a [TypeChecker] NFC: Adjust tests improved by new approach for ambiguity diagnosis 2020-06-12 11:47:03 -07:00
omochimetaru
21c9996a1f [ConstraintSystem][NFC] add test cases for argument matching 2020-05-30 22:58:45 +09:00
omochimetaru
8339e8ccd0 [ConstraintSystem][NFC] add tests for label matching diagnostics
It bakes current behavior for reviewing changes in future.
2020-05-24 06:54:07 +09:00
omochimetaru
339f179731 [ConstraintSystem][NFC] Move test cases about argument matching ...
from `diagnostics.swift` to `argument_matching.swift` which has
more specific interest.
2020-05-23 06:15:13 +09:00
omochimetaru
a6d97ecade [ConstraintSystem][NFC] rename keyword_arguments.swift to ...
`argument_matching.swift` in test.

New filename indicates that is also contains a test case for
matching of unlabeled arguments.
2020-05-23 05:40:36 +09:00