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
This commit is contained in:
John McCall
2015-05-02 01:52:37 +00:00
parent 4ce1891cae
commit 9065880e5a
10 changed files with 228 additions and 64 deletions

View File

@@ -1829,6 +1829,7 @@ void Serializer::writeForeignErrorConvention(const ForeignErrorConvention &fec){
auto kind = getRawStableForeignErrorConventionKind(fec.getKind());
uint8_t isOwned = fec.isErrorOwned() == ForeignErrorConvention::IsOwned;
uint8_t isReplaced = bool(fec.isErrorParameterReplacedWithVoid());
TypeID errorParameterTypeID = addTypeRef(fec.getErrorParameterType());
TypeID resultTypeID;
switch (fec.getKind()) {
@@ -1847,6 +1848,7 @@ void Serializer::writeForeignErrorConvention(const ForeignErrorConvention &fec){
ForeignErrorConventionLayout::emitRecord(Out, ScratchRecord, abbrCode,
static_cast<uint8_t>(kind),
isOwned,
isReplaced,
fec.getErrorParameterIndex(),
errorParameterTypeID,
resultTypeID);