src/com/google/javascript/jscomp/TypeCheck.java
/**
   * Checks enum aliases.
   *
   * <p>We verify that the enum element type of the enum used for initialization is a subtype of the
   * enum element type of the enum the value is being copied in.
   *
   * <p>Example:
   *
   * <pre>var myEnum = myOtherEnum;</pre>
   *
   * <p>Enum aliases are irregular, so we need special code for this :(
   *
   * @param valueType the type of the value used for initialization of the enum
   * @param nodeToWarn the node on which to issue warnings on
   */
Checks enum aliases.
We verify that the enum element type of the enum used for initialization is a subtype of the
enum element type of the enum the value is being copied in.

Example.

var myEnum = myOtherEnum;

Enum aliases are irregular, so we need special code for this :(

@param valueType the type of the value used for initialization of the enum
@param nodeToWarn the node on which to issue warnings on
Checks enum aliases . We verify that the enum element type of the enum used for initialization is a subtype of the enum element type of the enum the value is being copied in . Example . var myEnum = myOtherEnum ; Enum aliases are irregular so we need special code for this : ( @param valueType the type of the value used for initialization of the enum @param nodeToWarn the node on which to issue warnings on
private void checkEnumAlias(
      NodeTraversal t, JSDocInfo declInfo, JSType valueType, Node nodeToWarn) {
    if (declInfo == null || !declInfo.hasEnumParameterType()) {
      return;
    }
    if (!valueType.isEnumType()) {
      return;
    }
    EnumType valueEnumType = valueType.toMaybeEnumType();
    JSType valueEnumPrimitiveType =
        valueEnumType.getElementsType().getPrimitiveType();
    validator.expectCanAssignTo(
        t,
        nodeToWarn,
        valueEnumPrimitiveType,
        declInfo.getEnumParameterType().evaluate(t.getTypedScope(), typeRegistry),
        "incompatible enum element types");
  }
private void checkEnumAlias ( NodeTraversal t , JSDocInfo declInfo , JSType valueType , Node nodeToWarn ) { if ( declInfo == null || ! declInfo . hasEnumParameterType ( ) ) { return ; } if ( ! valueType . isEnumType ( ) ) { return ; } EnumType valueEnumType = valueType . toMaybeEnumType ( ) ; JSType valueEnumPrimitiveType = valueEnumType . getElementsType ( ) . getPrimitiveType ( ) ; validator . expectCanAssignTo ( t , nodeToWarn , valueEnumPrimitiveType , declInfo . getEnumParameterType ( ) . evaluate ( t . getTypedScope ( ) , typeRegistry ) , "incompatible enum element types" ) ; }
Checks enum aliases.
Checks enum aliases .