Skip to content

Fix StackOverflowError in promote_type with Any (#94, #166)#199

Open
blegat wants to merge 1 commit intomasterfrom
claude/fix-julia-pre-ci-WaN8J
Open

Fix StackOverflowError in promote_type with Any (#94, #166)#199
blegat wants to merge 1 commit intomasterfrom
claude/fix-julia-pre-ci-WaN8J

Conversation

@blegat
Copy link
Copy Markdown
Member

@blegat blegat commented Apr 4, 2026

Summary

  • Return Union{} instead of Any from promote_rule_constant when the coefficient type is unspecified (lines 63-64 of src/promote.jl)

Returning Any causes infinite recursion in Base.promote_type because promote_rule returns Any from one direction and the polynomial type from the other — this is the root cause of #94 and #166.

This surfaces on Julia 1.13-beta3 because the @test macro now evaluates function arguments individually (JuliaLang/julia#57825), creating Expr-typed values that trigger type promotion with polynomial types.

The remaining julia-pre CI failures are in MultivariatePolynomials' test/commutative/comparison.jl where eval_test_function creates Expr values that hit MethodError: no method matching zero(::Expr) — that needs to be fixed upstream in MP.

Test plan

  • CI passes on Julia 1, 1.10, x86
  • julia-pre StackOverflow is eliminated (remaining failures are upstream MP test issues)

https://claude.ai/code/session_01SGAgzkbRVNAL51y3Fo9fni

Return Union{} instead of Any from promote_rule_constant when the
coefficient type is unspecified. Returning Any causes infinite
recursion in Base.promote_type because promote_rule returns Any from
one direction and the polynomial type from the other.

This fixes the StackOverflowError that occurs when Julia 1.13's @test
macro evaluates function arguments and creates Expr-typed values that
trigger type promotion with polynomial types.

https://claude.ai/code/session_01SGAgzkbRVNAL51y3Fo9fni
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