Skip to content

Clean up some LLVM code - #16168

Closed
tristan957 wants to merge 3 commits into
mesonbuild:masterfrom
tristan957:llvm
Closed

Clean up some LLVM code#16168
tristan957 wants to merge 3 commits into
mesonbuild:masterfrom
tristan957:llvm

Conversation

@tristan957

Copy link
Copy Markdown
Member

No description provided.

There is no sense in exposing that we are returning a list. The list
should be immutable after this function call anyway.

Signed-off-by: Tristan Partin <tristan@partin.io>
We don't extend the list later, so let's use a tuple to make it
immutable.

Signed-off-by: Tristan Partin <tristan@partin.io>
Signed-off-by: Tristan Partin <tristan@partin.io>
@tristan957
tristan957 requested a review from jpakkane as a code owner August 28, 2026 16:52
@tristan957
tristan957 requested a review from dcbaker August 28, 2026 16:52

@eli-schwartz eli-schwartz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The overall goal here is not obvious but the implementation is definitely not something I can live with.

Comment thread mesonbuild/tooldetect.py
return None

def get_llvm_tool_names(tool: str) -> T.List[str]:
def get_llvm_tool_names(tool: str) -> T.Iterable[str]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, no, no, absolutely not.

There is no sense in exposing that we are returning a list. The list
should be immutable after this function call anyway.

This is type pedantry of the most impractical sense. str is the same type-checking type as Iterable[str].

Do not use "Iterable" or "Sequence" or related type concepts if one of the allowable types is a string. It gleefully type-checks the wrong thing.

The type system is broken. Opting out of the parts of it that are broken is the only valid solution. There's no such thing as a bug caused by "exposing that we are returning it as a list".

@tristan957 tristan957 closed this Aug 28, 2026
@tristan957
tristan957 deleted the llvm branch August 28, 2026 17:20
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