Skip to content

SPY0445 on a module-qualified parameter annotation: 'must be of type GeneratorContext, got sg.GeneratorContext' — the check compares annotation text #2141

Description

@antonsynd

Found by /verify-implementation plan-0ca7b7 (fix-override lane, 2026-09-27); pre-existing at BASE acd1d40 unless noted.

import sharpy.generators as sg

class G(sg.SourceGenerator):
    def generate(self, context: sg.GeneratorContext) -> sg.GeneratorOutput:
        return sg.GeneratorOutput("")

This fails with SPY0445 "must be of type 'GeneratorContext', got 'sg.GeneratorContext'". The unqualified from sharpy.generators import ... spelling passes. The validator compares the annotation's text, not the resolved type (the same class as bd2dd0a's __format__ fix in plan-0ca7b7 verification). Class contract: signature validators compare resolved types.

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

    lane:false-refusalA valid program (spec or python) is refusedreach:programAn ordinary program a Python programmer would write hits it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions