@@ -393,20 +393,31 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
393393 )
394394}
395395
396+ pragma [ nomagic]
397+ private predicate isTypeMentionedInModel ( string type ) {
398+ sourceModel ( type , _, _, _) or
399+ sinkModel ( type , _, _, _) or
400+ summaryModel ( type , _, _, _, _, _) or
401+ typeModel ( _, type , _)
402+ }
403+
404+ overlay [ global]
405+ private predicate isTypeUsedGlobal ( string type ) {
406+ isTypeMentionedInModel ( type ) and any ( TypeModel tm ) .isTypeUsed ( type )
407+ }
408+
409+ overlay [ local]
410+ private predicate isTypeUsedLocal ( string type ) = forceLocal( isTypeUsedGlobal / 1 ) ( type )
411+
396412/**
397413 * Holds if rows involving `type` might be relevant for the analysis of this database.
398414 */
399415predicate isRelevantType ( string type ) {
400- (
401- sourceModel ( type , _, _, _) or
402- sinkModel ( type , _, _, _) or
403- summaryModel ( type , _, _, _, _, _) or
404- typeModel ( _, type , _)
405- ) and
416+ isTypeMentionedInModel ( type ) and
406417 (
407418 Specific:: isTypeUsed ( type )
408419 or
409- any ( TypeModel model ) . isTypeUsed ( type )
420+ isTypeUsedLocal ( type )
410421 or
411422 exists ( TestAllModels t )
412423 )
0 commit comments