fix(frontend): allow typed object nil equality - #47
Merged
Conversation
- document issue #44 scope and failure chain - explain why frontend should keep BinaryOpInsn and NIL_COMPARISON - capture phased implementation and acceptance checks
- Narrow issue scope to typed object/null equality while preserving wider backend Nil semantics. - Ground Godot evidence in parser, analyzer, and Variant operator contracts. - Add Variant/DYNAMIC null regression expectations to prevent special-rule capture.
- Resolve object/null and null/null equality as bool in binary semantic support - Preserve Variant/DYNAMIC runtime-open routing and object/null ordering failures - Cover semantic, compile-check, lowering, and backend nil-comparison regressions - Sync frontend nil equality plan and unary/binary semantic documentation
- Add compile-check regression for object/null ordering failures. - Document Phase 3 coverage for equality-only nil comparison.
- Add smoke fixture for typed object/null equality true and false runtime cases. - Replace quadtree sentinel points with direct null-linked traversal. - Record focused and benchmark validation in the frontend equality plan.
…ract - merge the archived object/nil equality facts into the unary/binary semantic source of truth - delete the redundant standalone archive document - rewrite phase-oriented frontend comments as current stable contracts
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
This PR fixes frontend semantic resolution for typed object and
nullequality so ordinary nullable-object guards compile without sentinel workarounds. It aligns frontend typing and compile checks with the existing backend nil-comparison path.What changed
==and!=between typed object values andNilresolve toboolinstead of falling through to builtin operator metadata failure.nullguards lowering-ready.nilequality and for rejecting unsupported ordering operators.Why
nilcomparison, but frontend semantic typing rejected the same operand pair before lowering.current != nullin typed linked structures and forced benchmark code to avoid ordinary nullable-object guards.Affected packages/files
gd.script.gdcc.frontend.sema.analyzergd.script.gdcc.frontend.sema.analyzer.supportgd.script.gdcc.frontend.lowering.cfg.itemgd.script.gdcc.backend.c.gensrc/test/test_suite/unit_test/script/smoke/object_nil_equality.gddoc/module_impl/frontend/frontend_unary_binary_expr_semantic_implementation.mdValidation
./gradlew test --tests FrontendCompileCheckAnalyzerTest --tests FrontendExpressionSemanticSupportTest --tests FrontendLoweringBodyInsnPassTest --tests COperatorInsnGenTest --tests GdScriptUnitTestCompileRunnerTest --no-daemon --info --console=plain./gradlew classes --no-daemon --info --console=plainResult:
BUILD SUCCESSFULRisks / Notes
==and!=for object-NilandNil-Nilpairs are accepted.nilpairs still fail and remain covered by tests.Key behaviors covered (Optional)
typed_object == nullandtyped_object != nullresolve tobool.null == typed_objectandnull != typed_objectresolve tobool.null == nullandnull != nullresolve tobool.typed_object < nullremains rejected.while current != nullguards compile through frontend/lowering and reach backend nil-comparison handling.Diff stats (Optional)
Breaking changes (Optional)
Related docs (Optional)
doc/module_impl/frontend/frontend_unary_binary_expr_semantic_implementation.mdCloses #44