mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Ensure that we record the @unsafe for conformances introduced via extensions
This commit is contained in:
@@ -166,13 +166,17 @@ namespace {
|
||||
/// The location of the "preconcurrency" attribute if present.
|
||||
const SourceLoc preconcurrencyLoc;
|
||||
|
||||
/// The location of the "unsafe" attribute if present.
|
||||
const SourceLoc unsafeLoc;
|
||||
|
||||
ConformanceConstructionInfo() { }
|
||||
|
||||
ConformanceConstructionInfo(ProtocolDecl *item, SourceLoc loc,
|
||||
SourceLoc uncheckedLoc,
|
||||
SourceLoc preconcurrencyLoc)
|
||||
SourceLoc preconcurrencyLoc,
|
||||
SourceLoc unsafeLoc)
|
||||
: Located(item, loc), uncheckedLoc(uncheckedLoc),
|
||||
preconcurrencyLoc(preconcurrencyLoc) {}
|
||||
preconcurrencyLoc(preconcurrencyLoc), unsafeLoc(unsafeLoc) {}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -228,7 +232,7 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
|
||||
registerProtocolConformances(next, conformances);
|
||||
for (auto conf : conformances) {
|
||||
protocols.push_back(
|
||||
{conf->getProtocol(), SourceLoc(), SourceLoc(), SourceLoc()});
|
||||
{conf->getProtocol(), SourceLoc(), SourceLoc(), SourceLoc(), SourceLoc()});
|
||||
}
|
||||
} else if (next->getParentSourceFile() ||
|
||||
next->getParentModule()->isBuiltinModule()) {
|
||||
@@ -238,7 +242,8 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
|
||||
getDirectlyInheritedNominalTypeDecls(next, inverses, anyObject)) {
|
||||
if (auto proto = dyn_cast<ProtocolDecl>(found.Item))
|
||||
protocols.push_back(
|
||||
{proto, found.Loc, found.uncheckedLoc, found.preconcurrencyLoc});
|
||||
{proto, found.Loc, found.uncheckedLoc,
|
||||
found.preconcurrencyLoc, found.unsafeLoc});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +348,8 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
|
||||
addProtocol(
|
||||
locAndProto.Item, locAndProto.Loc,
|
||||
source.withUncheckedLoc(locAndProto.uncheckedLoc)
|
||||
.withPreconcurrencyLoc(locAndProto.preconcurrencyLoc));
|
||||
.withPreconcurrencyLoc(locAndProto.preconcurrencyLoc)
|
||||
.withUnsafeLoc(locAndProto.unsafeLoc));
|
||||
});
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user