public FuzzyBoolean matches(ResolvedTypeX[] someArgs) {
// do some quick length tests first
- int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length;
+ int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length;
if (numArgsMatchedByEllipsis < 0) return FuzzyBoolean.NO;
if ((numArgsMatchedByEllipsis > 0) && (ellipsisCount == 0)) {
return FuzzyBoolean.NO;
ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)typePatterns[i];
FuzzyBoolean matches = ap.matches(someArgs[argsIndex]);
if (matches == FuzzyBoolean.NO) {
- return FuzzyBoolean.NO;
+ return FuzzyBoolean.MAYBE; // could still match at runtime
} else {
argsIndex++;
ret = ret.and(matches);
// match the argument type at argsIndex with the ExactAnnotationTypePattern
// we know it is exact because nothing else is allowed in args
ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)arguments.get(i);
- TypeX argType = shadow.getArgType(i);
+ TypeX argType = shadow.getArgType(argsIndex);
ResolvedTypeX rArgType = argType.resolve(shadow.getIWorld());
if (rArgType == ResolvedTypeX.MISSING) {
IMessage msg = new Message(
"",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
}
if (ap.matches(rArgType).alwaysTrue()) {
+ argsIndex++;
continue;
} else {
// we need a test...
// TODO: binding
ResolvedTypeX rAnnType = ap.annotationType.resolve(shadow.getIWorld());
- ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(i),rAnnType));
+ ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(argsIndex),rAnnType));
+ argsIndex++;
}
}
}