private void checkForTypeMismatch(Rule r, LabelElementPair prevLabelPair, LabelElementPair labelPair) {
		// label already defined; if same type, no problem
		if (prevLabelPair.type != labelPair.type) {
			// Current behavior: take a token of rule declaration in case of left-recursive rule
			// Desired behavior: take a token of proper label declaration in case of left-recursive rule
			// See https://github.com/antlr/antlr4/pull/1585
			// Such behavior is referring to the fact that the warning is typically reported on the actual label redefinition,
			//   but for left-recursive rules the warning is reported on the enclosing rule.
			org.antlr.runtime.Token token = r instanceof LeftRecursiveRule
					? ((GrammarAST) r.ast.getChild(0)).getToken()
					: labelPair.label.token;
			errMgr.grammarError(
					ErrorType.LABEL_TYPE_CONFLICT,
					g.fileName,
					token,
					labelPair.label.getText(),
					labelPair.type + "!=" + prevLabelPair.type);
		}
		if (!prevLabelPair.element.getText().equals(labelPair.element.getText()) &&
			(prevLabelPair.type.equals(LabelType.RULE_LABEL) || prevLabelPair.type.equals(LabelType.RULE_LIST_LABEL)) &&
			(labelPair.type.equals(LabelType.RULE_LABEL) || labelPair.type.equals(LabelType.RULE_LIST_LABEL))) {

			org.antlr.runtime.Token token = r instanceof LeftRecursiveRule
					? ((GrammarAST) r.ast.getChild(0)).getToken()
					: labelPair.label.token;
			String prevLabelOp = prevLabelPair.type.equals(LabelType.RULE_LIST_LABEL) ? "+=" : "=";
			String labelOp = labelPair.type.equals(LabelType.RULE_LIST_LABEL) ? "+=" : "=";
			errMgr.grammarError(
					ErrorType.LABEL_TYPE_CONFLICT,
					g.fileName,
					token,
					labelPair.label.getText() + labelOp + labelPair.element.getText(),
					prevLabelPair.label.getText() + prevLabelOp + prevLabelPair.element.getText());
		}
	}
Make sure a label doesn't conflict with another symbol.
Labels must not conflict with: rules, tokens, scope names,
return values, parameters, and rule-scope dynamic attributes
defined in surrounding rule.  Also they must have same type
for repeated defs.
tool/src/org/antlr/v4/semantics/SymbolChecks.java