File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ class DefaultTypeRequest
362
362
TypeChecker &getTypeChecker () const ;
363
363
SourceFile *getSourceFile () const ;
364
364
llvm::SmallVectorImpl<Type> &getCache () const ;
365
- void recordDependencyOnCachedResult (Type result) const ;
365
+ bool isDependencyMissing (Type result) const ;
366
366
};
367
367
368
368
// / The zone number for the type checker.
Original file line number Diff line number Diff line change @@ -466,17 +466,17 @@ Optional<Type> DefaultTypeRequest::getCachedResult() const {
466
466
Type result = cache[size_t (getKnownProtocolKind ())];
467
467
if (!result)
468
468
return None;
469
- recordDependencyOnCachedResult (result);
469
+ assert (!isDependencyMissing (result) &&
470
+ " Since the cache is now cached by SourceFile, the dependency should have been recorded when it was looked up." );
470
471
return result;
471
472
}
472
473
473
- void DefaultTypeRequest::recordDependencyOnCachedResult (Type result) const {
474
- // An uncached result was looked up & the dependency was recorded there.
475
- // Here, record the dependency in case the cache spaces source files.
474
+ bool DefaultTypeRequest::isDependencyMissing (Type result) const {
476
475
if (const auto *NTD = result->getNominalOrBoundGenericNominal ())
477
476
if (auto *SF = getSourceFile ())
478
477
if (auto *tracker = SF->getReferencedNameTracker ())
479
- tracker->addTopLevelName (NTD->getBaseName (), true );
478
+ return tracker->getTopLevelNames ().find (NTD->getBaseName ()) == tracker->getTopLevelNames ().end ();
479
+ return false ;
480
480
}
481
481
482
482
void DefaultTypeRequest::cacheResult (Type value) const {
You can’t perform that action at this time.
0 commit comments