Commit Graph

5 Commits

Author SHA1 Message Date
Pavel Yaskevich
4132aa04f9 [Tests] NFC: Update all of the test-cases improved by changes to generic argument mismatch handling 2025-06-03 00:49:06 -07:00
Holly Borla
34b6241fc9 [Diagnostics] Move fix creation of AllowAutoClosurePointerConversion from
`matchTypes` to `repairFailures`.

This change handles invalid inout-to-pointer, array-to-pointer, and string-
to-pointer autoclosure conversions in the same way.
2019-08-07 18:05:51 -07:00
Holly Borla
7679a5a433 [Diagnostics] Improve the diagnostic for invalid optional pointer conversions for an
autoclosure result type.

Skip `ConstraintLocator::OptionalPayload` when checking if we're in an autoclosure context for
an inout-to-pointer conversion. This lets us apply the `AllowAutoClosurePointerConversion`
constraint fix when the pointer is optional.

This resolves rdar://problem/53532404
2019-08-07 12:41:11 -07:00
Holly Borla
e76f5f1d0b [Diagnostics] Improve the diagnostic for invalid pointer conversion for an autoclosure result type.
Add constraint fix `AllowAutoClosurePointerConversion` and corresponding diagnostic
`AutoClosurePointerConversionFailure`. When we discover that we're trying to do an
inout-to-pointer conversion in `matchTypes`, add the constraint fix, which tries to do the
conversion as if the pointer type is a regular function argument.
2019-08-02 14:16:06 -07:00
Mark Lacey
43775e817d Disallow some implicit pointer conversions in autoclosures.
Disallow implicit conversion or arguments from Array, String, and
InOut (formed by &) to pointer types if the argument is for an
@autoclosure parameter.

These conversions were really only intended to be used for C/ObjC
interop, and in some contexts like autoclosures they are not safe.

Fixes: rdar://problem/31538995
2018-05-16 12:13:25 -07:00