Commit Graph

15 Commits

Author SHA1 Message Date
Pavel Yaskevich
0a5b3f0727 [TypeChecker] SE-0324: Extend Swift -> C pointer conversions to inout
Fixes an oversight where `inout` -> C pointer conversion wasn't covered
by implementation of new pointer conversion semantics proposed by SE-0324.

Resolves: rdar://92583588
2022-05-25 20:55:22 -07:00
Pavel Yaskevich
cdf352d255 [TypeChecker] NFC: Add tests for type inference from default expression (when enabled) 2022-02-21 09:59:53 -08:00
Pavel Yaskevich
216f8a0146 [TypeChecker] NFC: Add test-cases for Swift -> C pointer conversions
Make sure that conversions are properly supported when arguments
either is wrapped in an optional type or requires a value-to-optional
promotion because parameter is optional pointer.
2021-09-20 17:22:26 -07:00
Pavel Yaskevich
621ea81e7b [ConstraintSystem] NFC: Add test-cases for interactions between Swift and C pointers 2021-09-20 17:22:25 -07:00
Holly Borla
a181f215d9 [CSApply] When re-writing an UnresolvedDotExpr as a member reference,
check if the member is a type reference and build a TypeExpr _before_
checking if the base is a module and building a simple DeclRefExpr.
2020-04-28 19:04:31 -07:00
Mark Lacey
83ebd71644 Allowing forming WritableKeyPath to read-only value in Swift 3/4.
We inadvertantly allowed this in the past, so continue to do so when
compiling in Swift 3/4 mode to avoid suddenly breaking existing code.

The diagnostic here is pretty bad, and I've opened issues for that as
well as providing some kind of deprecation warning for this so that
even under Swift 3/4 mode we alert users that this is unsupported.

rdar://problem/39802797
2018-05-08 14:26:02 -07:00
Mark Lacey
0959f0ce7d Take the IUO-ness of a parameter declaration into account in ranking.
Normally we wouldn't need this because we do not allow overloading by
parameter optionality. In this case, though, we import two Objective-C
methods that end up getting renamed to the same name in Swift, one of
which has a nullability annotation and the other of which doesn't.

Before IUOs were removed from the type system, we would have failed a
subtype test when ranking overloads, but now that subtype test passes
because we're comparing two optionals of the same type. So the change
here is to compare the optionality of the parameters and reject cases
where we are testing whether a plain optional is a subtype of
something declared to be an IUO.

Fixes rdar://problem/38719575.
2018-03-24 11:07:51 -07:00
Robert Widmann
3c1a6ab6d3 Reject member lookups that require bridging metatypes
We can only coerce metatypes covariantly but bridging
always requires an unrelated metatype cast.  When
performing member lookup, especially unqualified member
lookup, disregard static members from bridged types entirely.

See SR-5670 and rdar://problem/33830526
2017-08-13 12:39:33 -07:00
Mark Lacey
170dc8acd7 Do not penalize binding or equality constraints involving Any.
We currently have an element in the solution score related to whether we
had a binding or equality constraint involving Any.

Doing this yields some strange results, e.g. if overload resolution
results in a property declared as Any we end up discarding that solution
in favor of solutions that involve other overloads that are not declared
as Any but are also not actually better solutions (e.g. overloads that
are declared as function types).

We really want to retain both solutions in this case and allow the
ranking step of the solver to decide on the better choice.

Fixes rdar://problem/29374163, rdar://problem/29691909.
2016-12-20 13:38:14 -08:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Doug Gregor
0ff3239b96 Add new input needed for test/Constraints/dynamic_lookup.swift. 2016-04-06 16:43:18 -07:00
Jordan Rose
cf8baedee2 Re-apply "Rename @transparent to @_transparent for now."
This re-applies 90fcbfe9a6. I'll be committing
the corresponding change to Foundation momentarily.
2015-11-16 10:53:56 -08:00
Xin Tong
16843684b2 Revert "Rename @transparent to @_transparent for now."
This reverts commit 90fcbfe9a6.

Seems there are still some tests that are left not modified.
2015-11-14 07:04:31 -08:00
Jordan Rose
90fcbfe9a6 Rename @transparent to @_transparent for now.
This feature has not been fully designed, let alone properly implemented.
For more information, see docs/TransparentAttr.rst.
2015-11-13 16:25:34 -08:00
Jordan Rose
a2af37a19b Split PrintOptions::printEverything into printEverything and printVerbose.
The former is for debugging, the latter is for detailed presentation to users.
swift -print-ast will continue using printEverything, as will swift-ide-test,
but all other features should use printVerbose.

Swift SVN r20432
2014-07-23 22:28:55 +00:00