Skip to content

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Oct 1, 2025

This means it can be either str, File, or File | str, which gives us the value of knowing that if the input is T, the output is Dict[Compiler, List[T]]`

This means it can be either `str`, `File`, or `File | str`, which gives
us the value of knowing that if the input is T, the output is
Dict[Compiler, List[T]]`
@dcbaker dcbaker requested a review from jpakkane as a code owner October 1, 2025 20:34
@dcbaker dcbaker added the typing label Oct 1, 2025
@bonzini bonzini added this to the 1.10 milestone Oct 2, 2025

def classify_unity_sources(compilers: T.Iterable['Compiler'], sources: T.Sequence['FileOrString']) -> T.Dict['Compiler', T.List['FileOrString']]:
compsrclist: T.Dict['Compiler', T.List['FileOrString']] = {}
def classify_unity_sources(compilers: T.Iterable[Compiler], sources: T.Iterable[FileTypes]) -> T.Dict[Compiler, T.List[FileTypes]]:
Copy link
Member

Choose a reason for hiding this comment

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

This patch is itself the thing I stated must be destroyed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

--verbose, you mean that str is T.Iterable[str] just like it is T.Sequence[str]? This approach is still preferrable to yours if changed to have T.List[FileTypes] as the argument:

Suggested change
def classify_unity_sources(compilers: T.Iterable[Compiler], sources: T.Iterable[FileTypes]) -> T.Dict[Compiler, T.List[FileTypes]]:
def classify_unity_sources(compilers: T.Iterable[Compiler], sources: T.List[FileTypes]) -> T.Dict[Compiler, T.List[FileTypes]]:

I just checked and it still passes run_mypy. I'm opening a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

I already have a PR. :P

The context is #15057 (comment)

Copy link
Collaborator

@bonzini bonzini Oct 3, 2025

Choose a reason for hiding this comment

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

I know but I disagree that Union is the right solution.

Ok, won't open a PR but you can pick it yourself at https://github.com/bonzini/meson/commit/8e072288ffa0bca7e3c338d6ec5ca4588e5e8e0d.patch

@bonzini bonzini self-requested a review October 3, 2025 07:57
@bonzini bonzini closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants