Declaration[] decl = provider.getRequiredDeclarations();
for (Declaration aDecl : decl) {
Declaration resolved = resolver.getDeclaration(null,
aDecl.getIdentifier());
if (resolved != null && resolved != aDecl) {
provider.replaceDeclaration(aDecl,
resolved);
} else if (resolved == null) {
// it is probably an implicit declaration, so find the corresponding pattern
Pattern old = aDecl.getPattern();
Pattern current = resolver.findPatternByIndex(old.getIndex());