Code review comment: Since we need to evaluate the constant expressions for identifying the reinitialized (with different values) enum members, I moved this check into 'ConstantValueResolver'.

Code before review:
public boolean checkForUniqueSymbol(Location pos, SymbolEnv env, BSymbol symbol) {
BSymbol foundSym = symTable.notFoundSymbol;
int expSymTag = symbol.tag;
if ((expSymTag & SymTag.IMPORT) == SymTag.IMPORT) {
foundSym = lookupSymbolInPrefixSpace(env, symbol.name);
} else if ((expSymTag & SymTag.ANNOTATION) == SymTag.ANNOTATION) {
foundSym = lookupSymbolInAnnotationSpace(env, symbol.name);
} else if ((expSymTag & SymTag.CONSTRUCTOR) == SymTag.CONSTRUCTOR) {
foundSym = lookupSymbolInConstructorSpace(env, symbol.name);
}  else if ((expSymTag & SymTag.MAIN) == SymTag.MAIN) {
foundSym = lookupSymbolForDecl(env, symbol.name, SymTag.MAIN);
}
if (foundSym == symTable.notFoundSymbol && symbol.tag == SymTag.FUNCTION) {
int dotPosition = symbol.name.value.indexOf('.');
if (dotPosition > 0 && dotPosition != symbol.name.value.length()) {
String funcName = symbol.name.value.substring(dotPosition + 1);
foundSym = lookupSymbolForDecl(env, names.fromString(funcName), SymTag.MAIN);
}
}
if (foundSym == symTable.notFoundSymbol) {
return true;
}
if (!isDistinctSymbol(pos, symbol, foundSym)) {
return false;
}
if (isRedeclaredSymbol(symbol, foundSym)) {
Name name = symbol.name;
if (Symbols.isRemote(symbol) && !Symbols.isRemote(foundSym)
|| !Symbols.isRemote(symbol) && Symbols.isRemote(foundSym)) {
dlog.error(pos, DiagnosticErrorCode.UNSUPPORTED_REMOTE_METHOD_NAME_IN_SCOPE, name);
return false;
}
if (symbol.kind == SymbolKind.CONSTANT && symbol.type.tag == TypeTags.FINITE) {
BConstantSymbol symbolConst = (BConstantSymbol) symbol;
BConstantSymbol foundSymConst = (BConstantSymbol) foundSym;
BLangLiteral symbolTypeLiteral = (BLangLiteral) ((BFiniteType)
symbolConst.type).getValueSpace().iterator().next();
String symbolValue = (symbolTypeLiteral.value == null) ?
symbolTypeLiteral.originalValue : String.valueOf(symbolTypeLiteral.value);
BLangLiteral foundSymTypeLiteral = (BLangLiteral) ((BFiniteType)
foundSymConst.type).getValueSpace().iterator().next();
String foundSymValue = (foundSymTypeLiteral.value == null) ?
foundSymTypeLiteral.originalValue : String.valueOf(foundSymTypeLiteral.value);
int symbolLiteralType = symbolConst.literalType.tag;
int foundLiteralSymType = foundSymConst.literalType.tag;
if ((!symbolValue.equals(foundSymValue)) || (symbolLiteralType != foundLiteralSymType)) {
dlog.error(pos, DiagnosticErrorCode.REDECLARED_SYMBOL, name);
}
} else {
dlog.error(pos, DiagnosticErrorCode.REDECLARED_SYMBOL, name);
}
return false;
}
if ((foundSym.tag & SymTag.SERVICE) == SymTag.SERVICE) {
return false;
}
return true;
}

Line under review: }

Code after addressing the review:
public boolean checkForUniqueSymbol(Location pos, SymbolEnv env, BSymbol symbol) {
BSymbol foundSym = symTable.notFoundSymbol;
int expSymTag = symbol.tag;
if ((expSymTag & SymTag.IMPORT) == SymTag.IMPORT) {
foundSym = lookupSymbolInPrefixSpace(env, symbol.name);
} else if ((expSymTag & SymTag.ANNOTATION) == SymTag.ANNOTATION) {
foundSym = lookupSymbolInAnnotationSpace(env, symbol.name);
} else if ((expSymTag & SymTag.CONSTRUCTOR) == SymTag.CONSTRUCTOR) {
foundSym = lookupSymbolInConstructorSpace(env, symbol.name);
}  else if ((expSymTag & SymTag.MAIN) == SymTag.MAIN) {
foundSym = lookupSymbolForDecl(env, symbol.name, SymTag.MAIN);
}
if (foundSym == symTable.notFoundSymbol && symbol.tag == SymTag.FUNCTION) {
int dotPosition = symbol.name.value.indexOf('.');
if (dotPosition > 0 && dotPosition != symbol.name.value.length()) {
String funcName = symbol.name.value.substring(dotPosition + 1);
foundSym = lookupSymbolForDecl(env, names.fromString(funcName), SymTag.MAIN);
}
}
if (foundSym == symTable.notFoundSymbol) {
return true;
}
if (!isDistinctSymbol(pos, symbol, foundSym)) {
return false;
}
if (isRedeclaredSymbol(symbol, foundSym)) {
Name name = symbol.name;
if (Symbols.isRemote(symbol) && !Symbols.isRemote(foundSym)
|| !Symbols.isRemote(symbol) && Symbols.isRemote(foundSym)) {
dlog.error(pos, DiagnosticErrorCode.UNSUPPORTED_REMOTE_METHOD_NAME_IN_SCOPE, name);
return false;
}
if (symbol.kind != SymbolKind.CONSTANT) {
dlog.error(pos, DiagnosticErrorCode.REDECLARED_SYMBOL, name);
}
return false;
}
if ((foundSym.tag & SymTag.SERVICE) == SymTag.SERVICE) {
return false;
}
return true;
}