private boolean isApplicable ( Type . Callable candidate , LifetimeRelation lifetimes , Tuple < ? extends SemanticType > args ) { Tuple < Type > parameters = candidate . getParameters ( ) ; if ( parameters . size ( ) != args . size ( ) ) { // Differing number of parameters / arguments. Since we don't // support variable-length argument lists (yet), there is nothing // more to consider. return false ; } else { // Number of parameters matches number of arguments. Now, check that // each argument is a subtype of its corresponding parameter. for ( int i = 0 ; i != args . size ( ) ; ++ i ) { SemanticType param = parameters . get ( i ) ; if ( ! subtypeOperator . isSubtype ( param , args . get ( i ) , lifetimes ) ) { return false ; } } // return true ; } }
Determine whether a given function or method declaration is applicable to a given set of argument types . If there number of arguments differs it s definitely not applicable . Otherwise we need every argument type to be a subtype of its corresponding parameter type .