Skip to content

Member access on the None literal (None.qux) is SPY0908 CS0023 in every position — the checker never refuses it #2139

Description

@antonsynd

Found by the ILCompiles property sweep during /verify-implementation plan-0ca7b7 (seed 5F-Ai3FcPnEx, -e CsCheck_Seed=5F-Ai3FcPnEx). Pre-existing: identical at BASE acd1d40 and at 61bf20f (built sharpyc, run).

program body sharpy python3
x = None.qux SPY0908 CS0023 "Operator '.' cannot be applied to operand of type ''" AttributeError: 'NoneType' object has no attribute 'qux'
print(None.qux) SPY0908 CS0023 AttributeError
y: int = None.real SPY0908 CS0023 AttributeError
raise None.qux (the seed, inside def transform(foo: int) -> float) SPY0908 CS0023 AttributeError
raise None (control) SPY0242, refused correctly TypeError

The type checker resolves a member access whose receiver is the None literal without refusing it. The name doesn't exist on None's type, so it should be SPY0203 (no member) at semantic time, the way any other receiver with no such member is refused. Meta-class: SPY0908 as a net (docs/design/spy0908-policy.md). Standing harness: ILCompilesPropertyTests; add a None receiver cell to the member-access matrix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions