Repository navigation
hy-check(buildable): validate operand types and float widths for complex, real, and imag builtins (fixes #2896) - #4194
Open
SuperPiIot wants to merge 1 commit into
Conversation
SuperPiIot
force-pushed
the
fix/complex-real-imag-soundness
branch
2 times, most recently
from
November 9, 2026 01:33
8c311f5 to
b79a3eb
Compare
SuperPiIot
force-pushed
the
fix/complex-real-imag-soundness
branch
2 times, most recently
from
November 9, 2026 23:39
7fa41a5 to
88df5ea
Compare
…eal, and imag builtins (fixes limitlessprojects#2896)
SuperPiIot
force-pushed
the
fix/complex-real-imag-soundness
branch
from
November 10, 2026 01:16
88df5ea to
e43e26b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2896 under GUARANTEES.md Row 13 (BUILDABLE):
Under the Go specification (§Complex numbers):
complex(r, i)requires both operands to be floating-point numbers of identical type (float32orfloat64).complex(r, i)rejects typed integers (int32,int64, etc.) and mismatched float widths (float32vsfloat64).real(c)andimag(c)require the operand to be a complex number (complex64orcomplex128).real(c)andimag(c)reject non-complex numbers (float32,float64,int32,int, etc.).Changes
compiler/crates/hy-check/src/buildable.rs:call_result_scalarsforcomplex,real, andimag.check_builtin_operand_kindsto validate scalar types forrealandimag, rejecting non-complex arguments (float32,float64,int32, etc.) withHYB-E1002.check_builtin_operand_kindsforcomplexto reject non-float arguments (int32,int64, etc.) and enforce that both operands have matching floating-point widths (float32vsfloat64) withHYB-E1002.compiler/crates/hy-check/tests/complex_scalars_operand_soundness.rs(13/13 tests passing).hy-checkunit test suite (183/183 passing) and differential 135-corpus (90/90 reject agreement).Fixes #2896
Settlement Coordinates