Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] multi-input Get selectors #13974

Closed
wants to merge 2 commits into from

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Dec 23, 2021

WIP take on the syntax parts of #7490

Tom Dyas added 2 commits December 23, 2021 04:17
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
_Awaitable = TypeVar("_Awaitable")


class _AwaitableInitTrampoline(Generic[_Awaitable, _Output, _Input]):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear to me what the types here should even be.

I am getting this error when even trying to run fmt on this code:

Traceback (most recent call last):
  File "/Users/tdyas/TC/pants/src/python/pants/bin/pants_loader.py", line 19, in <module>
    from pants.bin.pants_runner import PantsRunner
  File "/Users/tdyas/TC/pants/src/python/pants/bin/pants_runner.py", line 13, in <module>
    from pants.bin.remote_pants_runner import RemotePantsRunner
  File "/Users/tdyas/TC/pants/src/python/pants/bin/remote_pants_runner.py", line 15, in <module>
    from pants.option.global_options import GlobalOptions
  File "/Users/tdyas/TC/pants/src/python/pants/option/global_options.py", line 27, in <module>
    from pants.engine.environment import CompleteEnvironment
  File "/Users/tdyas/TC/pants/src/python/pants/engine/environment.py", line 10, in <module>
    from pants.engine.rules import collect_rules, rule
  File "/Users/tdyas/TC/pants/src/python/pants/engine/rules.py", line 29, in <module>
    from pants.engine.goal import Goal
  File "/Users/tdyas/TC/pants/src/python/pants/engine/goal.py", line 12, in <module>
    from pants.option.subsystem import Subsystem
  File "/Users/tdyas/TC/pants/src/python/pants/option/subsystem.py", line 12, in <module>
    from pants.engine.internals.selectors import AwaitableConstraints, Get
  File "/Users/tdyas/TC/pants/src/python/pants/engine/internals/selectors.py", line 323, in <module>
    class Effect(Generic[_Output, _Input], Awaitable[_Output, _Input]):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

cc @Eric-Arellano

@@ -56,12 +56,79 @@ class AwaitableConstraints:
input_type: type
is_effect: bool

# Parse the following Get forms:
# c = await Get[C](B, b) # we can do this now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so: this aspect of the description was stale over there. We actually only parse Get(C, B, b), etc: while the indexing for type hints is supported, it's usually inferred, and the actual input type is required currently.

We briefly did actually support index-only (Get[C](B, b)), but we removed it. Sorry for the confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still an intent to have the other forms that use brackets though?

That is:

await Get[E](Params((C, c), (D, d))) 
await Get[F](Params(C(...), D(...)))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change would still need to have use of brackets to return a trampoline which isn't required if the syntax does not use brackets at all.

@tdyas tdyas closed this Aug 26, 2022
@tdyas tdyas deleted the multi_param_selectors branch August 26, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants