Skip to content

Add a compiler warning for increment/decrement on Nullable type #13

@ggleyzer

Description

@ggleyzer

Since Nullable is an Enum and therefore Sequential, it inherits nextValue() and prevValue() API and "++" and "--" ops. For example,

Int? i = Null;
i++;

successfully compiles and throws OutOfBounds exception.

Dima and Cam suggested to issue a compiler warning if those ops applied to Nullable type. The warning should say:

Operation is not permitted, because the type is Nullable, so the value may be Null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions