Conversation
- Remove Class type, AnyClass primitive, and all related support - Remove class keyword/token from lexer, parser, and grammar - Remove CannotTagClass/CannotTagContainingClass errors - Renumber error codes E020+ to fill gaps - Remove is_class_type() from Type trait and all implementations - Update tests to remove class-related test cases - Update expected parser error messages
There was a problem hiding this comment.
Pull request overview
This PR removes Slice1 class support from the slicec compiler, including the Class AST/grammar element and the AnyClass primitive, and updates related diagnostics and tests accordingly.
Changes:
- Removed
classkeyword/token/grammar productions and theClasselement across AST, patchers, validators, and visitor traversal. - Removed
AnyClassfrom primitives and eliminated class-specific tagging/validation rules and errors. - Updated/removed tests and adjusted expected parser error messages; renumbered diagnostics starting at E020 to close gaps.
Reviewed changes
Copilot reviewed 50 out of 50 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| slicec/tests/typealias_tests.rs | Drops class/AnyClass-related typealias test cases. |
| slicec/tests/tag_tests.rs | Replaces class usage with struct and removes class-tagging tests. |
| slicec/tests/structs/mode_compatibility.rs | Removes Slice2 failure case that depended on AnyClass. |
| slicec/tests/primitives/mode_compatibility.rs | Deletes primitive compilation-mode compatibility tests (previously included AnyClass and other primitives). |
| slicec/tests/primitives/mod.rs | Removes inclusion of mode_compatibility module and AnyClass primitive parsing case. |
| slicec/tests/parser_tests.rs | Updates expected token list in syntax error message (removes class). |
| slicec/tests/optional_tests.rs | Removes optional tests that referenced AnyClass and class. |
| slicec/tests/interfaces/mode_compatibility.rs | Deletes cross-file mode-compat test that depended on classes. |
| slicec/tests/interfaces/mod.rs | Removes mode_compatibility submodule. |
| slicec/tests/interfaces/inheritance.rs | Updates inheritance mismatch test to use struct instead of class. |
| slicec/tests/exceptions/inheritance.rs | Removes exception inheritance mismatch test that depended on classes. |
| slicec/tests/dictionaries/key_type.rs | Removes disallowed key-type cases involving AnyClass/class. |
| slicec/tests/cycle_tests.rs | Removes cycle test that depended on classes allowing cycles. |
| slicec/tests/compilation_mode_tests.rs | Updates expected token list in syntax error message (removes class). |
| slicec/tests/classes/tags.rs | Deletes class tag test module. |
| slicec/tests/classes/mode_compatibility.rs | Deletes class mode-compatibility tests. |
| slicec/tests/classes/mod.rs | Deletes the entire classes test module. |
| slicec/tests/classes/inheritance.rs | Deletes class inheritance tests. |
| slicec/tests/classes/container.rs | Deletes class container/cycle tests. |
| slicec/tests/class_tests.rs | Deletes top-level class test harness module. |
| slicec/src/visitor.rs | Removes visitor hooks/traversal for Class. |
| slicec/src/validators/mod.rs | Removes class validation visitor implementation. |
| slicec/src/validators/members.rs | Removes “tagged members cannot use/contain classes” validation. |
| slicec/src/validators/identifiers.rs | Removes redefinition checking for class entities. |
| slicec/src/validators/dictionary.rs | Removes class-related key-type formatting/checks. |
| slicec/src/validators/cycle_detection.rs | Removes class “cycle breaker” behavior. |
| slicec/src/slice_file_converter.rs | Removes class conversion handling (still panics for exceptions). |
| slicec/src/patchers/type_ref_patcher.rs | Removes base-class patching logic. |
| slicec/src/patchers/encoding_patcher.rs | Removes class-specific encoding support and nullable allowances. |
| slicec/src/patchers/comment_link_patcher.rs | Removes class nodes from comment-link patching. |
| slicec/src/parsers/slice/tokens.rs | Removes ClassKeyword and AnyClassKeyword tokens. |
| slicec/src/parsers/slice/mod.rs | Removes message-generation mappings for class/AnyClass tokens. |
| slicec/src/parsers/slice/lexer.rs | Removes lexing for class and AnyClass. |
| slicec/src/parsers/slice/grammar.rs | Removes construct_class builder function. |
| slicec/src/parsers/slice/grammar.lalrpop | Removes class productions and AnyClass primitive mapping. |
| slicec/src/grammar/wrappers.rs | Removes Class from generated wrapper enums/traits. |
| slicec/src/grammar/traits.rs | Removes is_class_type() from Type trait. |
| slicec/src/grammar/elements/type_alias.rs | Removes is_class_type() forwarding implementation. |
| slicec/src/grammar/elements/struct.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/sequence.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/result.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/primitive.rs | Removes AnyClass primitive and related tag/encoding behavior. |
| slicec/src/grammar/elements/mod.rs | Stops exporting/removing the class element module. |
| slicec/src/grammar/elements/enum.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/dictionary.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/custom_type.rs | Removes is_class_type() implementation. |
| slicec/src/grammar/elements/class.rs | Deletes the Class element definition entirely. |
| slicec/src/diagnostics/errors.rs | Removes class-tagging errors and renumbers E020+ codes. |
| slicec/src/ast/node.rs | Removes Class from AST node variants and conversions. |
| slicec/src/ast/mod.rs | Removes builtin AnyClass primitive from AST initialization and updates primitive count. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
InsertCreativityHere
left a comment
There was a problem hiding this comment.
All the class changes look good to me!
Just gotta hunt down the leftover compact ID things.
| } | ||
|
|
||
| Class: OwnedPtr<Class> = { | ||
| <p: Prelude> <l: @L> class_keyword <i: ContainerIdentifier> <r1: @R> <ci: CompactId?> <r2: @R> <tr: (":" <TypeRef>)?> "{" <dms: UndelimitedList<Field>> "}" ContainerEnd => { |
There was a problem hiding this comment.
You should also remove everything related to compact IDs, which are only used by classes.
Probably already deleted any tests about them, since they were in the classes module, but definitely still some lingering traces in the source. Maybe rg for compact.?id and hope that's all of them?
Part of #742