Skip to content

Commit d9af96f

Browse files
committed
[AST] Remove more interface-type redundancy from ProtocolConformance.
1 parent 4da11aa commit d9af96f

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ class ASTContext {
662662
/// Produce a new normal conformance for a property behavior.
663663
NormalProtocolConformance *
664664
getBehaviorConformance(Type conformingType,
665-
Type conformingInterfaceType,
666665
ProtocolDecl *protocol,
667666
SourceLoc loc,
668667
AbstractStorageDecl *storage,

include/swift/AST/ProtocolConformance.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ class NormalProtocolConformance : public ProtocolConformance,
355355
}
356356

357357
NormalProtocolConformance(Type conformingType,
358-
Type conformingInterfaceType,
359358
ProtocolDecl *protocol,
360359
SourceLoc loc, AbstractStorageDecl *behaviorStorage,
361360
ProtocolConformanceState state)

lib/AST/ASTContext.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,16 +1476,14 @@ void ValueDecl::setLocalDiscriminator(unsigned index) {
14761476

14771477
NormalProtocolConformance *
14781478
ASTContext::getBehaviorConformance(Type conformingType,
1479-
Type conformingInterfaceType,
14801479
ProtocolDecl *protocol,
14811480
SourceLoc loc,
14821481
AbstractStorageDecl *storage,
14831482
ProtocolConformanceState state) {
14841483
auto conformance = new (*this, AllocationArena::Permanent)
1485-
NormalProtocolConformance(conformingType, conformingInterfaceType,
1486-
protocol, loc, storage, state);
1484+
NormalProtocolConformance(conformingType, protocol, loc, storage, state);
14871485

1488-
if (auto nominal = conformingInterfaceType->getAnyNominal()) {
1486+
if (auto nominal = conformingType->getRValueInstanceType()->getAnyNominal()) {
14891487
// Note: this is an egregious hack. The conformances need to be associated
14901488
// with the actual storage declarations.
14911489
SmallVector<ProtocolConformance *, 2> conformances;

lib/Sema/CodeSynthesis.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,19 +1805,16 @@ void swift::maybeAddAccessorsToVariable(VarDecl *var, TypeChecker &TC) {
18051805
// The conformance will be on the containing 'self' type, or '()' if the
18061806
// property is in a non-type context.
18071807
Type behaviorSelf;
1808-
Type behaviorInterfaceSelf;
18091808
if (dc->isTypeContext()) {
1810-
behaviorInterfaceSelf = dc->getSelfInterfaceType();
1811-
behaviorSelf = dc->mapTypeIntoContext(behaviorInterfaceSelf);
1809+
behaviorSelf = dc->getSelfTypeInContext();
18121810
assert(behaviorSelf && "type context doesn't have self type?!");
18131811
if (var->isStatic())
18141812
behaviorSelf = MetatypeType::get(behaviorSelf);
18151813
} else {
1816-
behaviorSelf = behaviorInterfaceSelf = TC.Context.TheEmptyTupleType;
1814+
behaviorSelf = TC.Context.TheEmptyTupleType;
18171815
}
18181816

18191817
conformance = TC.Context.getBehaviorConformance(behaviorSelf,
1820-
behaviorInterfaceSelf,
18211818
behaviorProto,
18221819
behavior->getLoc(), var,
18231820
ProtocolConformanceState::Checking);

0 commit comments

Comments
 (0)