fix(types): validate symbolic parameter defaults#565
Merged
Conversation
nahime0
force-pushed
the
fix/enum-case-default-validation
branch
from
July 19, 2026 09:09
840194a to
c44b638
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
This replaces the approach proposed in #468 with post-schema semantic validation for symbolic parameter defaults.
infer_expr_type_syntacticclassifies everyScopedConstantAccessasStr. AcceptingEnum::Membersolely because the receiver name matches the declared object type would therefore bypass validation and also accept missing enum cases or scalar class constants.This PR instead:
infer_scoped_constant_access;self::,static::, andparent::receivers;Testing
cargo buildcargo test --test codegen_tests accepts_enum_casecargo test --test codegen_tests enum_case_defaultcargo test --test error_tests enum_case_parameter_default_rejects_missing_casecargo test --test error_tests object_parameter_default_rejects_scalar_class_constantcargo test --test error_tests plain_property_enum_case_default_remains_unsupportedcargo test --test codegen_tests interface_promoted_property_accepts_object_defaultcargo test --test error_tests promoted_property_rejects_incompatible_object_defaultgit diff --checkRelated: #468