if (basicTemplatesMap.containsKey(templateName)) {
TemplateNode prevTemplate = basicTemplatesMap.get(templateName);
// If this duplicate definition is not an explicit Soy V1 override, report error.
if (!node.isOverride()) {
SoyFileNode prevTemplateFile = prevTemplate.getNearestAncestor(SoyFileNode.class);
SoyFileNode currTemplateFile = node.getNearestAncestor(SoyFileNode.class);
if (currTemplateFile == prevTemplateFile) {
throw SoySyntaxExceptionUtils.createWithNode(
"Found two definitions for template name '" + templateName + "', both in the file " +
currTemplateFile.getFilePath() + ".",
node);
} else {
String prevTemplateFilePath = prevTemplateFile.getFilePath();
String currTemplateFilePath = currTemplateFile.getFilePath();
if (currTemplateFilePath != null && currTemplateFilePath.equals(prevTemplateFilePath)) {
throw SoySyntaxExceptionUtils.createWithNode(
"Found two definitions for template name '" + templateName +
"' in two different files with the same name " + currTemplateFilePath +
" (perhaps the file was accidentally included twice).",