[ty] Add support for goto in literal enum member inlay hint by MatthewMckee4 · Pull Request #24792 · astral-sh/ruff (original) (raw)

The PR itself looks good to me. Thanks for implementing it. Unfortunately, it does make a pre-existing issue more prominent:

from test import Color

x = Color.RED

test.py:

from enum import Enum

class Color(Enum): RED = 1 BLUE = 2

Applying the inlay adds from test import Color, RED, which is incorrect.

I'm inclined to merge this PR, given that it's a pre-existing issue. However, this becomes a much more prominent problem with enums. Which is why I'd prefer if we try to fix astral-sh/ty#3313 first, if it's not too hard.