@Test void signature_not_match() { when(funcSignature.getFunctionName()).thenReturn(unresolvedFuncName); when(funcSignature.getParamTypeList()) .thenReturn(Arrays.asList(ExprCoreType.STRING, ExprCoreType.STRING)); FunctionSignature unresolvedFunSig = new FunctionSignature(unresolvedFuncName, unresolvedParamTypeList); assertEquals(NOT_MATCH, unresolvedFunSig.match(funcSignature)); }
public int match(FunctionSignature functionSignature) { List<ExprType> functionTypeList = functionSignature.getParamTypeList(); if (!functionName.equals(functionSignature.getFunctionName()) || paramTypeList.size() != functionTypeList.size()) { return NOT_MATCH; } int matchDegree = EXACTLY_MATCH; for (int i = 0; i < paramTypeList.size(); i++) { ExprType paramType = paramTypeList.get(i); ExprType funcType = functionTypeList.get(i); int match = WideningTypeRule.distance(paramType, funcType); if (match == WideningTypeRule.IMPOSSIBLE_WIDENING) { return NOT_MATCH; } else { matchDegree += match; } } return matchDegree; }
FunctionSignature { public int match(FunctionSignature functionSignature) { List<ExprType> functionTypeList = functionSignature.getParamTypeList(); if (!functionName.equals(functionSignature.getFunctionName()) || paramTypeList.size() != functionTypeList.size()) { return NOT_MATCH; } int matchDegree = EXACTLY_MATCH; for (int i = 0; i < paramTypeList.size(); i++) { ExprType paramType = paramTypeList.get(i); ExprType funcType = functionTypeList.get(i); int match = WideningTypeRule.distance(paramType, funcType); if (match == WideningTypeRule.IMPOSSIBLE_WIDENING) { return NOT_MATCH; } else { matchDegree += match; } } return matchDegree; } }
FunctionSignature { public int match(FunctionSignature functionSignature) { List<ExprType> functionTypeList = functionSignature.getParamTypeList(); if (!functionName.equals(functionSignature.getFunctionName()) || paramTypeList.size() != functionTypeList.size()) { return NOT_MATCH; } int matchDegree = EXACTLY_MATCH; for (int i = 0; i < paramTypeList.size(); i++) { ExprType paramType = paramTypeList.get(i); ExprType funcType = functionTypeList.get(i); int match = WideningTypeRule.distance(paramType, funcType); if (match == WideningTypeRule.IMPOSSIBLE_WIDENING) { return NOT_MATCH; } else { matchDegree += match; } } return matchDegree; }  }
FunctionSignature { public int match(FunctionSignature functionSignature) { List<ExprType> functionTypeList = functionSignature.getParamTypeList(); if (!functionName.equals(functionSignature.getFunctionName()) || paramTypeList.size() != functionTypeList.size()) { return NOT_MATCH; } int matchDegree = EXACTLY_MATCH; for (int i = 0; i < paramTypeList.size(); i++) { ExprType paramType = paramTypeList.get(i); ExprType funcType = functionTypeList.get(i); int match = WideningTypeRule.distance(paramType, funcType); if (match == WideningTypeRule.IMPOSSIBLE_WIDENING) { return NOT_MATCH; } else { matchDegree += match; } } return matchDegree; }  int match(FunctionSignature functionSignature); String formatTypes(); }
FunctionSignature { public int match(FunctionSignature functionSignature) { List<ExprType> functionTypeList = functionSignature.getParamTypeList(); if (!functionName.equals(functionSignature.getFunctionName()) || paramTypeList.size() != functionTypeList.size()) { return NOT_MATCH; } int matchDegree = EXACTLY_MATCH; for (int i = 0; i < paramTypeList.size(); i++) { ExprType paramType = paramTypeList.get(i); ExprType funcType = functionTypeList.get(i); int match = WideningTypeRule.distance(paramType, funcType); if (match == WideningTypeRule.IMPOSSIBLE_WIDENING) { return NOT_MATCH; } else { matchDegree += match; } } return matchDegree; }  int match(FunctionSignature functionSignature); String formatTypes(); static final Integer NOT_MATCH; static final Integer EXACTLY_MATCH; }