8000 remove unused trait bound by Guest0x0 · Pull Request #2369 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

remove unused trait bound #2369

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 1 commit into from
Jun 27, 2025
Merged

remove unused trait bound #2369

merged 1 commit into from
Jun 27, 2025

Conversation

Guest0x0
Copy link
Contributor

This PR removes unused trait bound in core, using unused warning for trait bounds, which is currently under development in MoonBit compiler.

Copy link
Verify Hash trait bound removal in get_with_hash

Category
Correctness
Code Snippet
fn[K : Eq, V] get_with_hash(self : T[K, V], key : K, hash : Int) -> V?
Recommendation
The Hash trait removal appears correct since the hash is passed as parameter, but document why Hash isn't needed
Reasoning
It's important to explicitly document when a trait bound is intentionally omitted despite the function dealing with hash values, to prevent accidental reintroduction of the bound in future

Consider documenting trait bound changes in API docs

Category
Maintainability
Code Snippet
pub fn[A] new() -> T[A] { ... }
Recommendation
Add documentation noting that the function intentionally has no trait bounds to make it more flexible
Reasoning
API documentation should explain design decisions around type constraints to help users understand what is required vs. optional

Some trait bound removals may affect maintainability of balance functions

Category
Maintainability
Code Snippet
fn[K, V] balance(key : K, value : V, l : T[K, V], r : T[K, V]) -> T[K, V]
Recommendation
Consider keeping Compare bound and documenting that it may be needed for future tree balancing optimizations
Reasoning
Balance functions in tree structures often need ordering comparisons. While not currently used, removing the bound may make future optimizations harder

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 103

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.361%

Totals Coverage Status
Change from base Build 99: 0.0%
Covered Lines: 3452
Relevant Lines: 3863

💛 - Coveralls

@Guest0x0 Guest0x0 merged commit fbb9e83 into main Jun 27, 2025
10 checks passed
@Guest0x0 Guest0x0 deleted the Guest0x0/fix-unused-trait-bound branch June 27, 2025 06:08
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
0