@@ -486,45 +486,70 @@ signature predicate interestedInFunctionDeclarations(
486486) ;
487487
488488module FunctionDeclarationTypeEquivalence<
489- TypeEquivalenceSig Config, interestedInFunctionDeclarations / 2 interestedInFunctions >
489+ TypeEquivalenceSig Config, interestedInFunctionDeclarations / 2 interestedInFunDecls >
490490{
491491 private predicate interestedInReturnTypes ( Type a , Type b ) {
492492 exists ( FunctionDeclarationEntry aFun , FunctionDeclarationEntry bFun |
493- interestedInFunctions ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
493+ interestedInFunDecls ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
494494 a = aFun .getType ( ) and
495495 b = bFun .getType ( )
496496 )
497497 }
498498
499499 private predicate interestedInParameterTypes ( Type a , Type b ) {
500500 exists ( FunctionDeclarationEntry aFun , FunctionDeclarationEntry bFun , int i |
501- interestedInFunctions ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
501+ interestedInFunDecls ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
502502 a = aFun .getParameterDeclarationEntry ( i ) .getType ( ) and
503503 b = bFun .getParameterDeclarationEntry ( i ) .getType ( )
504504 )
505505 }
506506
507507 predicate equalReturnTypes ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 ) {
508- interestedInFunctions ( f1 , f2 ) and
508+ interestedInFunDecls ( f1 , f2 ) and
509509 TypeEquivalence< Config , interestedInReturnTypes / 2 > :: equalTypes ( f1 .getType ( ) , f2 .getType ( ) )
510510 }
511511
512512 predicate equalParameterTypes ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 ) {
513- interestedInFunctions ( f1 , f2 ) and
513+ interestedInFunDecls ( f1 , f2 ) and
514514 f1 .getDeclaration ( ) = f2 .getDeclaration ( ) and
515515 forall ( int i | exists ( [ f1 , f2 ] .getParameterDeclarationEntry ( i ) ) |
516516 equalParameterTypesAt ( f1 , f2 , pragma [ only_bind_into ] ( i ) )
517517 )
518518 }
519519
520520 predicate equalParameterTypesAt ( FunctionDeclarationEntry f1 , FunctionDeclarationEntry f2 , int i ) {
521- interestedInFunctions ( f1 , f2 ) and
521+ interestedInFunDecls ( f1 , f2 ) and
522522 f1 .getDeclaration ( ) = f2 .getDeclaration ( ) and
523523 TypeEquivalence< Config , interestedInParameterTypes / 2 > :: equalTypes ( f1 .getParameterDeclarationEntry ( pragma [ only_bind_into ] ( i ) )
524524 .getType ( ) , f2 .getParameterDeclarationEntry ( pragma [ only_bind_into ] ( i ) ) .getType ( ) )
525525 }
526526}
527527
528+ signature predicate interestedInFunctions ( Function f1 , Function f2 ) ;
529+
530+ module FunctionEquivalence< TypeEquivalenceSig Config, interestedInFunctions / 2 interestedInFuncs> {
531+ private predicate interestedInParameterTypes ( Type a , Type b ) {
532+ exists ( Function aFun , Function bFun , int i |
533+ interestedInFuncs ( pragma [ only_bind_into ] ( aFun ) , pragma [ only_bind_into ] ( bFun ) ) and
534+ a = aFun .getParameter ( i ) .getType ( ) and
535+ b = bFun .getParameter ( i ) .getType ( )
536+ )
537+ }
538+
539+ predicate equalParameterTypes ( Function f1 , Function f2 ) {
540+ interestedInFuncs ( f1 , f2 ) and
541+ forall ( int i | exists ( [ f1 , f2 ] .getParameter ( i ) ) |
542+ equalParameterTypesAt ( f1 , f2 , pragma [ only_bind_into ] ( i ) )
543+ )
544+ }
545+
546+ predicate equalParameterTypesAt ( Function f1 , Function f2 , int i ) {
547+ interestedInFuncs ( f1 , f2 ) and
548+ TypeEquivalence< Config , interestedInParameterTypes / 2 > :: equalTypes ( f1 .getParameter ( pragma [ only_bind_into ] ( i ) )
549+ .getType ( ) , f2 .getParameter ( pragma [ only_bind_into ] ( i ) ) .getType ( ) )
550+ }
551+ }
552+
528553private class LeafType extends Type {
529554 LeafType ( ) {
530555 not this instanceof DerivedType and
0 commit comments