Type system first draft - #232
JonatanWaern wants to merge 8 commits into
Conversation
Makes the naming slightly more consistent
Signed-off-by: Jonatan Waern
f72e411 to
bfbbf5e
Compare
cfce43d to
4d11d1a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Integer parsing, function equivalence, and layout/template type navigation contain correctness defects.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Introduces the first semantic DML type system and integrates it with symbol lookup, diagnostics, and LSP navigation.
Changes:
- Adds unresolved/resolved type models, typedef resolution, equivalence checks, and diagnostics.
- Adds goto-type-definition and typed member navigation.
- Expands annotation-based lookup/error tests and makes template-cycle handling deterministic.
File summaries
| File | Description |
|---|---|
tests/test_files/type_shadow_lookup.dml |
Tests separate type/value namespaces. |
tests/test_files/type_lookup.dml |
Tests type and member navigation. |
tests/test_files/goto_impl_test.dml |
Updates template-as-type expectations. |
tests/test_files/extern_typedef_unknown_type.dml |
Tests unknown extern typedef types. |
tests/test_files/errors_unknown_type.dml |
Tests unknown-type diagnostics. |
tests/test_files/errors_typedef_self_ref_pointer.dml |
Tests pointer-mediated recursion. |
tests/test_files/errors_typedef_duplicate.dml |
Tests duplicate typedef diagnostics. |
tests/test_files/errors_typedef_cyclic.dml |
Tests cyclic typedef diagnostics. |
tests/test_files/errors_templates_traits.dml |
Tests template/type collisions and overrides. |
tests/test_files/errors_template_cycle.dml |
Tests template-cycle reporting. |
tests/test_files/errors_object_params.dml |
Tests parameter diagnostics. |
tests/test_files/errors_methods.dml |
Tests method type and override diagnostics. |
tests/test_files/errors_isolated_misc.dml |
Tests structural diagnostics. |
tests/test_files/errors_builtin_type_lookup.dml |
Exercises builtin type resolution. |
tests/test_files/errors_bad_version.dml |
Tests unsupported-version reporting. |
tests/lsp_lookup_tests.rs |
Adds goto-type-definition test support. |
tests/error_reporting_tests.rs |
Adds annotation-driven diagnostic testing. |
src/server/mod.rs |
Advertises and registers type-definition support. |
src/server/dispatch.rs |
Adds type-definition dispatch. |
src/lib.rs |
Adjusts internal-error macro expansion. |
src/analysis/templating/types.rs |
Implements resolved type semantics and storage. |
src/analysis/templating/traits.rs |
Resolves trait member and method types. |
src/analysis/templating/topology.rs |
Fixes deterministic template-cycle handling. |
src/analysis/templating/objects.rs |
Propagates resolved types through objects. |
src/analysis/templating/mod.rs |
Updates declarations to resolved types. |
src/analysis/templating/methods.rs |
Adds method type-equivalence validation. |
src/analysis/symbols.rs |
Associates resolved types with symbols. |
src/analysis/structure/types.rs |
Implements unresolved type parsing and resolution. |
src/analysis/structure/toplevel.rs |
Exposes typedefs as symbols. |
src/analysis/structure/statements.rs |
Updates derives for new type structures. |
src/analysis/structure/objects.rs |
Stores unresolved types in declarations. |
src/analysis/structure/mod.rs |
Adds structural parsing test helpers. |
src/analysis/structure/expressions.rs |
Stores unresolved expression types. |
src/analysis/reference.rs |
Extends global-reference access. |
src/analysis/parsing/types.rs |
Renames type variants and finds field containers. |
src/analysis/parsing/tree.rs |
Enables AST node downcasting. |
src/analysis/mod.rs |
Integrates type storage and member symbols. |
src/actions/semantic_lookup.rs |
Implements typed semantic lookup. |
src/actions/requests.rs |
Handles LSP type-definition requests. |
CHANGELOG.md |
Documents type-system and cycle fixes. |
Review details
- Files reviewed: 40/40 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
9de1309 to
aaeb238
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Recursive aliases, qualifiers, typed parameters, and mixed template-member references have unresolved semantic lookup defects.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 40/40 changed files
- Comments generated: 6
- Review effort level: Balanced
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern
aaeb238 to
7e8c7fc
Compare
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
7e8c7fc to
2c3a482
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Nested anonymous structs, inherited trait members, and sequence type-definition lookup have unresolved correctness gaps.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
src/analysis/structure/objects.rs:1091
- Return validation has the same outermost-only gap: an anonymous struct wrapped in a pointer, array, vector, or function declarator is accepted, although anonymous structs remain invalid in method return types. Recursively inspect the unresolved return type rather than matching only
UnresolvedType::Struct.
for ret in &returns {
if let UnresolvedType::Struct(s) = ret {
- Files reviewed: 54/54 changed files
- Comments generated: 3
- Review effort level: Balanced
| match concrete.as_ref() { | ||
| DMLConcreteType::Typedef(td) => { outermost.get_or_insert(td.decl_name.span); } | ||
| DMLConcreteType::Trait(t) => { outermost.get_or_insert(t.decl_name.span); } | ||
| _ => {} | ||
| } |
| symbols.trait_member_symbols.entry(name.clone()).or_insert_with(|| { | ||
| trait_info.params.values() | ||
| .chain(trait_info.sessions.values()) | ||
| .chain(trait_info.saveds.values()) | ||
| .map(|decl| { |
| for arg in &arguments { | ||
| if let MethodArgument::Typed(_, UnresolvedType::Struct(s)) = arg { |
Supports first layer of type semantics and goto def/ref/decl stuff. Does not yet support cast-checking or can-store semantics