Skip to content

extend/kernel: tighten up some type signatures #20356

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

Merged
merged 2 commits into from
Aug 1, 2025
Merged

extend/kernel: tighten up some type signatures #20356

merged 2 commits into from
Aug 1, 2025

Conversation

carlocab
Copy link
Member

@carlocab carlocab commented Aug 1, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Allowing either Formulae or Strings in these methods leads to errors
at runtime when one hasn't done require "formula" yet.

Let's tighten these up so that they only accept Formula arguments to
guarantee that require "formula" has been done before they are called.
For callers that need to pass a String, we update them to call a
version of these methods that accepts only Strings.

See discussion at #20352.

Allowing either `Formula`e or `String`s in these methods leads to errors
at runtime when one hasn't done `require "formula"` yet.

Let's tighten these up so that they only accept `Formula` arguments to
guarantee that `require "formula"` has been done before they are called.
For callers that need to pass a `String`, we update them to call a
version of these methods that accepts only `String`s.

See discussion at #20352.
It doesn't look like these are even needed.
@carlocab carlocab enabled auto-merge August 1, 2025 18:12
carlocab added a commit that referenced this pull request Aug 1, 2025
This does the same as #20356 for `ensure_formula_installed!`. See
discussion at #20352.

Unfortunately, one must still `require "formula"` before using this
method because of the `returns(Formula)`, but tightening the type
signature is generally a good idea anyway.

Closes #20352.
carlocab added a commit that referenced this pull request Aug 1, 2025
This does the same as #20356 for `ensure_formula_installed!`. See
discussion at #20352.

Unfortunately, one must still `require "formula"` before using this
method because of the `returns(Formula)`, but tightening the type
signature is generally a good idea anyway.

Closes #20352.
@carlocab carlocab added this pull request to the merge queue Aug 1, 2025
Merged via the queue into main with commit f2c3215 Aug 1, 2025
36 checks passed
@carlocab carlocab deleted the kernel-sigs branch August 1, 2025 18:55
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