Commit Graph

116 Commits

Author SHA1 Message Date
Dmitri Hrybenko
8d8a462ee1 Revert "Generate method/property @encodings from the foreign"
This reverts commit r29266.  It broke buildbots.

Swift SVN r29271
2015-06-03 03:49:32 +00:00
John McCall
ed68d261e7 Generate method/property @encodings from the foreign
SILFunctionType of the method instead of its formal type.

Gives more accurate information to the @encoding, makes
foreign error conventions work implicitly, and allows
IRGen's Swift-to-Clang to avoid duplicating arbitrary
amounts of the bridging logic from SILGen.

Some finagling was required in order to avoid calling
getConstantFunctionType from within other kinds of
lowering, which might have re-entered a generic context.

Also required fixing a bug with the type lowering of
optional DynamicSelfTypes where we would end up with
a substituted type in the lowered type.

Also, for some reason, our @encoding for -dealloc
methods was pretending that there was a formal parameter.
There didn't seem to be any justification for this,
and it's not like Clang does that.  Fixed.

Swift SVN r29266
2015-06-03 02:33:38 +00:00
John McCall
9065880e5a When an error import would conflict with another method,
preserve the original method name.

This heuristic is based on the Objective-C selector and therefore
doesn't really handle factory methods that would conflict with
initializers, but we can hope that those simply don't come up in
the wild.

It's not clear that this is the best thing to do --- it tends to
promote the non-throwing API over what's probably a newer, throwing
API --- but it's significantly easier, and it unblocks code without
creating deployment problems.

Swift SVN r28066
2015-05-02 01:52:37 +00:00
John McCall
f138a84f49 Instead of making a temporary uncurried function type, just
handle curried method types directly in AbstractionPattern.

NFC.

Swift SVN r28033
2015-05-01 08:00:45 +00:00
John McCall
9638611277 Use AbstractionPattern to find Clang types for inputs and
results when finding bridged types, rather than reinventing
(well, pre-inventing) the same thing elsewhere.

Doing this apparently forces AbstractionPattern to deal
with ObjC protocol methods for the first time, which are
generic and therefore require even the Clang-based
abstraction patterns to propagate generic signatures.

Use this infrastructure to allow foreign error conventions
to suppress the wrapping of nonnull bridged collection results
in a level of optionality.  We can't treat nil results as
an empty collection while simultaneously treating them as
an error signal.

Swift SVN r28022
2015-05-01 04:38:17 +00:00
John McCall
77f58e99ea Fix ObjC method abstraction patterns for foreign errors.
Swift SVN r27943
2015-04-29 23:11:24 +00:00
John McCall
9f38d8da50 Require a GenericSignature for dependent AbstractionPatterns.
We still don't actually handle these correctly, but at least
we have sensible information for them now.

Also, remember that we're working with canonical generic
signatures in more places.

Swift SVN r27388
2015-04-16 23:27:00 +00:00
John McCall
d62a154e29 Import ObjC method error-handling conventions. WIP.
Swift SVN r27193
2015-04-10 00:32:54 +00:00
John McCall
dc4b8ff2c2 Incorporate an optional Clang type into AbstractionPattern.
This is necessary for correctly dealing with non-standard
ownership conventions in secondary positions, and it should
also help with non-injective type imports (like BOOL/_Bool).
But right now we aren't doing much with it.

Swift SVN r26954
2015-04-03 21:39:31 +00:00
John McCall
7c3f911ba3 Incremental work to try to hide the type of an AbstractionPattern.
Swift SVN r18936
2014-06-16 20:28:12 +00:00
John McCall
a1b469ed2f ExplosionKind -> ResilienceExpansion. NFC.
Swift SVN r12364
2014-01-16 00:25:29 +00:00
Joe Groff
990212b1c6 SILGen: When applying the result function of a function, do not reabstract to the original callee's abstraction pattern.
We already reabstracted the result function to the substituted function type. Quick fix for <rdar://problem/15598596>.

Swift SVN r12307
2014-01-15 01:20:14 +00:00
Joe Groff
7331eddfcc SIL: Handle dependent types in AbstractionPattern::isOpaque.
To do this with complete accuracy requires mapping the dependent types into a context, but isOpaque is currently only used as a sanity check in assertions, and a tuple being matched to a class-constrained archetype is an unlikely enough occurrence that it's probably OK to accept this inaccuracy instead of trying to push generic contexts all the way down into isOpaque's clients.

Swift SVN r11824
2014-01-02 19:04:00 +00:00
Chris Lattner
1cda63d0b3 sil abstraction patterns never see @lvalue types, only @inout types.
Swift SVN r11797
2014-01-01 20:24:34 +00:00
Chris Lattner
9ae289de46 Drive the semantic wedge harder into lvalues. Now, instead of having one LValueType
with qualifiers on it, we have two distinct types:
 - LValueType(T) aka @lvalue T, which is used for mutable values on the LHS of an
   assignment in the typechecker.
 - InOutType(T) aka @inout T, which is used for @inout arguments, and the implicit
   @inout self argument of mutable methods on value types.  This type is also used
   at the SIL level for address types.

While I detangled a number of cases that were checking for LValueType (without checking
qualifiers) and only meant @inout or @lvalue, there is more to be done here.  Notably,
getRValueType() still strips @inout, which is totally and unbearably wrong.



Swift SVN r11727
2013-12-29 22:23:11 +00:00
John McCall
4bba9b38f8 Make several new interfaces traffic in AbstractionPatterns.
Swift SVN r10621
2013-11-21 02:19:46 +00:00