Consider this a Pants engine joke: ```class X: ...
# development
b
Consider this a Pants engine joke:
Copy code
class X:
    async def helper():
        pass

class Y(X):
    async def helper():
        return await Get(Snapshot, PathGlobs(["..."]))

@rule
async def my_rule(request: RequestType) -> RetType:
    if False:
        # Just for static scraping purposes
        Get(Snapshot, PathGlobs, None)

    x_or_y: X = get_some_X_or_Y_instance()
    foo = await x_or_y.helper()
    ...
Which I think might be the gist of Stu's `union`+`rule_helper` idea 😮
a
(I presume the goal here is to be able to write rules that dispatch on the subtypes, yes?)
b
Ideally. Although, of course, this is presented as a joke because it's an abuse of the system 🙂
w
yea, that’s it.
b
I thought I might need to implement this for the
lint
changes, but turns out I don't. Still glad I finally understand the issue comment 😅
w
yea, sorry… that was haphazard.
b
Lol no worries. I DO NOT wanna try and debug THAT rule graph error though, when one does occur 😅
w
yea. i hate implementing https://github.com/pantsbuild/pants/pull/16717 in the current rule graph solving algorithm, because it’s so complex already. really want to revisit the refactor i have there.
it was probably always a separate idea/feature, but i wanted to connect it to the biggest “`@union` API” ticket that was already open
a
Oh dear @bitter-ability-32190, you made a joke and it resulted in an issue getting opened. I hope you’re happy 😆
😉 1