NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY constant

CompileTimeErrorCode const NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY

13.9 Switch: Given a switch statement of the form switch (e) { label11 … label1j1 case e1: s1 … labeln1 … labelnjn case en: sn default: sn+1} or the form switch (e) { label11 … label1j1 case e1: s1 … labeln1 … labelnjn case en: sn}, it is a compile-time error if the expressions ek are not compile-time constants, for all 1 <= k <= n.

12.1 Constants: A qualified reference to a static constant variable that is not qualified by a deferred prefix.

Implementation

NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
    'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY',
    "Constant values from a deferred library can't be used as a case "
        "expression.",
    correction:
        "Try re-writing the switch as a series of if statements, or "
        "changing the import to not be deferred.")