INITIALIZER_FOR_STATIC_FIELD constant

CompileTimeErrorCode const INITIALIZER_FOR_STATIC_FIELD

7.6.1 Generative Constructors: Let k be a generative constructor. It is a compile-time error if k's initializer list contains an initializer for a variable that is not an instance variable declared in the immediately surrounding class.

Parameters: 0: the name of the initializing formal that is a static variable in the immediately enclosing class

See INITIALIZING_FORMAL_FOR_STATIC_FIELD.

Implementation

static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD =
    CompileTimeErrorCode(
        'INITIALIZER_FOR_STATIC_FIELD',
        "'{0}' is a static field in the enclosing class. Fields initialized "
            "in a constructor can't be static.",
        correction: "Try removing the initialization.")