Skip to content

Declare global names as const#181

Merged
daanhb merged 2 commits into
JuliaApproximation:masterfrom
jishnub:jishnub/times_const
Jun 17, 2026
Merged

Declare global names as const#181
daanhb merged 2 commits into
JuliaApproximation:masterfrom
jishnub:jishnub/times_const

Conversation

@jishnub

@jishnub jishnub commented Jun 8, 2026

Copy link
Copy Markdown
Member

This helps with type inference.

On master

julia> d = ChebyshevInterval();

julia> f(d) = DomainSets.:(×)(d, d)
f (generic function with 1 method)

julia> @code_warntype f(d)
MethodInstance for f(::ChebyshevInterval{Float64})
  from f(d) @ Main REPL[5]:1
Arguments
  #self#::Core.Const(Main.f)
  d::Core.Const(-1.0 .. 1.0 (Chebyshev))
Body::Any
1%1 = Main.DomainSets::Core.Const(DomainSets)
│   %2 = Base.getproperty(%1, :×)::Any%3 = (%2)(d, d)::Any
└──      return %3

with this pR

julia> @code_warntype f(d)
MethodInstance for f(::ChebyshevInterval{Float64})
  from f(d) @ Main REPL[3]:1
Arguments
  #self#::Core.Const(Main.f)
  d::Core.Const(-1.0 .. 1.0 (Chebyshev))
Body::DomainSets.FixedIntervalProduct{2, Float64, ChebyshevInterval{Float64}}
1%1 = Main.DomainSets::Core.Const(DomainSets)
│   %2 = Base.getproperty(%1, :×)::Core.Const(DomainSets.cartesianproduct)
│   %3 = (%2)(d, d)::Core.Const((-1.0 .. 1.0 (Chebyshev)) × (-1.0 .. 1.0 (Chebyshev)))
└──      return %3

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.86%. Comparing base (905e0b6) to head (8244b74).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #181   +/-   ##
=======================================
  Coverage   93.86%   93.86%           
=======================================
  Files          27       27           
  Lines        1843     1843           
=======================================
  Hits         1730     1730           
  Misses        113      113           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jishnub jishnub changed the title Declare × as a const Declare global names as const Jun 9, 2026
@daanhb daanhb merged commit f095869 into JuliaApproximation:master Jun 17, 2026
7 checks passed
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