Skip to content

utils/clang: allow Version type for kernel_version - #23536

Merged
cho-m merged 1 commit into
mainfrom
clang-kernel_version-type
Aug 16, 2026
Merged

utils/clang: allow Version type for kernel_version#23536
cho-m merged 1 commit into
mainfrom
clang-kernel_version-type

Conversation

@cho-m

@cho-m cho-m commented Aug 15, 2026

Copy link
Copy Markdown
Member

Fixes type error in LLVM formulae:

TypeError: Parameter 'kernel_version': Expected type
T.any(Integer, String), got type Version with value #<Version 27>

As MacOSVersion.kernel_major_version returns a Version which all LLVM formulae currently use during build.

Seen in


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Copilot AI lite review requested due to automatic review settings August 15, 2026 21:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts Utils::Clang.write_system_config_files鈥檚 Sorbet signature to accept a Version for kernel_version, addressing a Sorbet runtime TypeError seen when LLVM formulae pass MacOSVersion.kernel_major_version (a Version) during builds.

Changes:

  • Extend the kernel_version parameter type to T.any(String, Integer, Version) in Library/Homebrew/utils/clang.rb.

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/utils/clang.rb Outdated
Fixes type error in LLVM formulae:
```
TypeError: Parameter 'kernel_version': Expected type
T.any(Integer, String), got type Version with value #<Version 27>
```

As `MacOSVersion.kernel_major_version` returns a `Version` which all
LLVM formulae currently use during build.
@cho-m
cho-m force-pushed the clang-kernel_version-type branch from 7e8b4a7 to 48dfc81 Compare August 15, 2026 22:01
@cho-m
cho-m requested a lite review from Copilot August 15, 2026 22:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Library/Homebrew/utils/clang.rb:12

  • The updated Sorbet signature no longer accepts Integer values for kernel_version (it used to be T.any(String, Integer)). Since the method implementation only interpolates the value into filenames (i.e. to_s), it can safely accept both the new Version and the previous Integer to avoid breaking any existing callers that still pass an integer kernel major.
        config_dir:     Pathname,
        macos_version:  T.any(String, MacOSVersion),
        kernel_version: T.any(String, Version),
        arch:           Symbol,
      ).void

@cho-m
cho-m added this pull request to the merge queue Aug 16, 2026
Merged via the queue into main with commit bfae037 Aug 16, 2026
55 of 56 checks passed
@cho-m
cho-m deleted the clang-kernel_version-type branch August 16, 2026 03:32

@MikeMcQuaid MikeMcQuaid 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.

Thanks!

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.

4 participants