feat(compiler): support vectori to vector implicit conversion#35
Merged
Conversation
- Add gdcc_lir_intrinsic.md as the shared call_intrinsic surface and registry catalog. - Link low IR, frontend lowering, and int-to-float docs to the new intrinsic fact source. - Add the Vector*i -> Vector* implementation plan with intrinsic maintenance steps.
- Add Vector2i/3i/4i to Vector2/3/4 frontend intrinsic-cast compatibility. - Rename boundary decision wording to ALLOW_WITH_INTRINSIC_CAST across docs and code. - Keep ClassRegistry assignability strict and cover vector specificity/negative cases.
- Emit vector intrinsic casts for Vector2i/3i/4i typed boundaries. - Cover local, assignment, call, return, and subscript lowering paths. - Add LIR parser and serializer roundtrip coverage for vector intrinsics.
- Register Vector2i/3i/4i to Vector2/3/4 C backend intrinsics. - Emit gdextension-lite constructor conversions through CBodyBuilder.callAssign. - Cover registry, CALL_INTRINSIC dispatch, and invalid signature cases.
- Accept same-dimension Vector2i/3i/4i payloads for Vector2/3/4 call_func params. - Materialize widened vector args through gdcc_intrinsic helper constructors. - Guard backend vector wrapper generation with builtin dimension validation. - Cover generated gates, include syncing, and runtime positive/negative anchors.
- Add frontend sema tests for assignment, type-check, and fixed-call overload behavior. - Add C build/runtime and test-suite anchors for ordinary Vector*i to Vector* boundaries. - Update vector conversion plan and test-suite guidance with completed step status.
- Add constructor route regressions for exact Vector*i, widening Vector*, and Variant fallback ranking. - Document call_func wrapper gate ordering before wrapper-only vector helper materialization. - Clarify vector inbound widening metadata and runtime gate contracts.
- Merge scalar and vector implicit conversion notes into one maintained backend contract. - Remove completed implementation-plan documents and update LIR intrinsic references. - Clarify call_func vector helper gate ordering in code comments.
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
Adds same-dimension
Vector*i -> Vector*implicit conversion support across frontend semantic boundaries, lowering, LIR intrinsics, C backend codegen, and inboundcall_funcwrappers. This keeps global assignability strict while materializing accepted conversions through explicit backend-owned intrinsic routes.What changed
Vector2i/3i/4i -> Vector2/3/4, including overload specificity shared by bare calls, constructor resolution, andScopeMethodResolverfrontend paths.CALL_INTRINSICinstructions and added parser/serializer coverage for the vector intrinsic names.CBodyBuilder.callAssign(...).call_funcwrappers soVector2/3/4parameters accept same-dimensionVector*iVariant payloads without changing method metadata orr_error->expected.doc/module_impl/backend/implicit_conversion_implementation.mdand updated LIR intrinsic references.Why
int -> floatwidening at ordinary typed boundaries.call_funcwrappers bypass frontend lowering, so wrapper gates and local materialization need their own narrow compatibility rule.Affected packages/files
gd.script.gdcc.frontend.sema.analyzer.support: boundary compatibility and constructor/call ranking coverage.gd.script.gdcc.frontend.lowering.pass.body: intrinsic-cast materialization for vector boundaries.gd.script.gdcc.backend.c.gen: intrinsic registry/codegen, wrapper gates, and helper materialization.gd.script.gdcc.lir.parser:CALL_INTRINSICparser/serializer coverage.src/main/c/codegen/include_451/gdcc: wrapper-only inbound vector materialization helpers.doc/gdcc_lir_intrinsic.md,doc/module_impl/backend/implicit_conversion_implementation.md, frontend/backend conversion contract docs.src/test/test_suite/unit_test: runtime anchors for vector widening and guard cases.Validation
script/run-gradle-targeted-tests.sh --tests FrontendVariantBoundaryCompatibilityTest,ClassRegistryTest,ScopeMethodResolverTestscript/run-gradle-targeted-tests.sh --tests FrontendBodyLoweringSessionTest,FrontendLoweringBodyInsnPassTestscript/run-gradle-targeted-tests.sh --tests SimpleLirBlockInsnParserTest,SimpleLirBlockInsnSerializerTestscript/run-gradle-targeted-tests.sh --tests CallIntrinsicInsnGenTest,CIntrinsicManagerTest,CVectorIToVectorIntrinsicTestscript/run-gradle-targeted-tests.sh --tests CGenHelperTest,CCodegenTestscript/run-gradle-targeted-tests.sh --tests GdScriptUnitTestCompileRunnerTestscript/run-gradle-targeted-tests.sh --tests FrontendAssignmentSemanticSupportTest,FrontendTypeCheckAnalyzerTest,FrontendExpressionSemanticSupportTest,ScopeMethodResolverTestscript/run-gradle-targeted-tests.sh --tests FrontendLoweringToCProjectBuilderIntegrationTest.lowerVectorIToVectorBoundariesBuildConstructorIntrinsicAndRunInGodot,GdScriptUnitTestCompileRunnerTest.listsExpectedBundledUnitScripts,GdScriptUnitTestCompileRunnerTest.compilesAndValidatesInitializerScriptsscript/run-gradle-targeted-tests.sh --tests FrontendBodyLoweringSessionTest,FrontendLoweringBodyInsnPassTest,CCodegenTest,GdScriptUnitTestCompileRunnerTest.compilesAndValidatesRuntimeScriptsscript/run-gradle-targeted-tests.sh --tests FrontendConstructorResolutionSupportTestgit diff --checkResult:
BUILD SUCCESSFULfor the targeted Gradle suites that were run.Risks / Notes
ClassRegistry.checkAssignable(...)remains strict; vector widening is only a frontend ordinary-boundary and inboundcall_funcwrapper rule.Vector* -> Vector*i, wrong-dimension vector conversion,Rect2i -> Rect2, container recursive covariance, and operator promotion remain unsupported.r_error->expectedcontinue to publish the target parameter type.Key behaviors covered (Optional)
Variantpack.c_vector*i_to_vector*intrinsics for local, assignment, call, return, and dictionary subscript boundaries.godot_new_VectorN_with_VectorNi(...)constructor conversions instead of C casts.Object.call(..., Vector*i(...))forVector*parameters while rejecting reverse and adjacent strict conversions.Diff stats (Optional)
Breaking changes (Optional)
Related docs (Optional)
doc/module_impl/backend/implicit_conversion_implementation.mddoc/gdcc_lir_intrinsic.mddoc/module_impl/frontend/frontend_implicit_conversion_matrix.mddoc/module_impl/backend/variant_abi_contract.md