Skip to content

Commit c7aa014

Browse files
committed
Sema: make StructuralTypeRequest use CacheKind::Cached
1 parent a315e44 commit c7aa014

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

include/swift/AST/ASTTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ SWIFT_TYPEID(Type)
2020
SWIFT_TYPEID(PropertyDelegateBackingPropertyInfo)
2121
SWIFT_TYPEID(PropertyDelegateTypeInfo)
2222
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
23+
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)

include/swift/AST/ASTTypeIDs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct PropertyDelegateBackingPropertyInfo;
2626
struct PropertyDelegateTypeInfo;
2727
class Type;
2828
class VarDecl;
29+
class TypeAliasDecl;
2930

3031
#define SWIFT_AST_TYPEID_ZONE 1
3132

include/swift/AST/TypeCheckRequests.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class PropertyDelegateBackingPropertyInfoRequest :
551551
/// Retrieve the structural type of an alias type.
552552
class StructuralTypeRequest :
553553
public SimpleRequest<StructuralTypeRequest,
554-
CacheKind::SeparatelyCached,
554+
CacheKind::Cached,
555555
Type,
556556
TypeAliasDecl*> {
557557
public:
@@ -568,13 +568,10 @@ class StructuralTypeRequest :
568568
void diagnoseCycle(DiagnosticEngine &diags) const;
569569
void noteCycleStep(DiagnosticEngine &diags) const;
570570

571-
// Separate caching.
572-
bool isCached() const { return true; };
573-
Optional<Type> getCachedResult() const;
574-
void cacheResult(Type value) const;
571+
// Caching.
572+
bool isCached() const { return true; }
575573
};
576574

577-
578575
// Allow AnyValue to compare two Type values, even though Type doesn't
579576
// support ==.
580577
template<>

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,3 @@ void StructuralTypeRequest::diagnoseCycle(DiagnosticEngine &diags) const {
672672
void StructuralTypeRequest::noteCycleStep(DiagnosticEngine &diags) const {
673673
diags.diagnose(SourceLoc(), diag::circular_reference_through);
674674
}
675-
676-
Optional<Type> StructuralTypeRequest::getCachedResult() const {
677-
auto decl = std::get<0>(getStorage());
678-
if (decl->getUnderlyingTypeLoc().getType())
679-
return decl->getUnderlyingTypeLoc().getType();
680-
return None;
681-
}
682-
683-
void StructuralTypeRequest::cacheResult(Type value) const {
684-
auto decl = std::get<0>(getStorage());
685-
decl->getUnderlyingTypeLoc().setType(value);
686-
}

0 commit comments

Comments
 (0)