Skip to content

Slightly improve inferred types in runtests#100

Merged
giordano merged 3 commits intoJuliaTesting:mainfrom
jishnub:jishnub/box
Mar 1, 2026
Merged

Slightly improve inferred types in runtests#100
giordano merged 3 commits intoJuliaTesting:mainfrom
jishnub:jishnub/box

Conversation

@jishnub
Copy link
Contributor

@jishnub jishnub commented Mar 1, 2026

This avoids p and done being boxed and improves the inferred type of jobs from Any to Int. This also leads to some of the types of downstream variables --- e.g.,workers --- being inferred.

Comment on lines +1004 to +1005
# Use a copy of p to prevent it from being boxed
p2 = p
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't a copy, it's the same as p, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, how did you see p is boxed? JETLS doesn't detect it.

Copy link
Contributor Author

@jishnub jishnub Mar 1, 2026

Choose a reason for hiding this comment

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

Yes sorry I meant create a new binding instead of assigning to the existing one. I used Cthulhu.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please at least fix the comment? It's rather misleading as is now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

JETLS doesn't detect it.

Oh, I had to wait some more time for JETLS to finish the analysis and report p as boxed.

Copy link
Collaborator

@giordano giordano Mar 1, 2026

Choose a reason for hiding this comment

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

Also, p as it was used before didn't make any sense at all, I'm simplifying this in #101 #103.

Comment on lines +790 to +791
jobs = something(args.jobs, default_njobs())
jobs = clamp(jobs, 1, length(tests))
jobs::Int = clamp(jobs, 1, length(tests))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even with this change, the first jobs is reported as boxed by JETLS. Maybe do something like

    _jobs = something(args.jobs, default_njobs())
    jobs = clamp(_jobs, 1, length(tests))

?

@giordano giordano merged commit 16f47d4 into JuliaTesting:main Mar 1, 2026
22 checks passed
@giordano
Copy link
Collaborator

giordano commented Mar 1, 2026

This PR broke reusing workers.

giordano added a commit that referenced this pull request Mar 1, 2026
giordano added a commit that referenced this pull request Mar 1, 2026
* Revert "Remove useless `workers` variable (#103)"

This reverts commit 7f27702.

* Revert "Slightly improve inferred types in `runtests` (#100)"

This reverts commit 16f47d4.

* Add a test to ensure workers are reused correctly
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