Type system first draft - #232
Open
JonatanWaern wants to merge 5 commits into
Open
Conversation
Makes the naming slightly more consistent
Signed-off-by: Jonatan Waern
JonatanWaern
force-pushed
the
type-system
branch
from
August 27, 2026 08:12
f72e411 to
bfbbf5e
Compare
Open
Signed-off-by: Jonatan Waern
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
JonatanWaern
force-pushed
the
type-system
branch
from
September 1, 2026 07:32
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.
| }; | ||
| match kind { | ||
| // A typedef is its own type-definition. | ||
| DMLSymbolKind::Typedef => { |
Comment on lines
+1435
to
+1439
| DMLConcreteType::StructType(st) => | ||
| return Some(FieldContainer::Struct(st.clone())), | ||
| DMLConcreteType::Trait(t) => | ||
| return Some(FieldContainer::Trait(t.clone())), | ||
| other => other.peel_one()?.clone(), |
| file: FileSpec<'a>) -> Option<UnresolvedType> { | ||
| lazy_static! { | ||
| static ref INT_RE: Regex = | ||
| Regex::new(r"(u?)int([1-5][0-9]?|6[0-4]?|[789])(_be_t|_le_t)?$") |
| .unwrap(); | ||
| } | ||
| if let Some(captures) = INT_RE.captures(name) { | ||
| let signed = captures.get(1).is_none(); |
| } | ||
| }; | ||
| let endianness = captures.get(3).map( | ||
| |en|if en.as_str() == "be_t" { Endianness::BE } |
Comment on lines
+334
to
+339
| self.base.equivalent(&other.base) | ||
| && self.arg_types.len() == other.arg_types.len() | ||
| && self.arg_types.iter().zip( | ||
| other.arg_types.iter()).all( | ||
| |(ty1, ty2)|dmltype_equivalent(ty1, ty2)) | ||
| && dmltype_equivalent(&self.return_ty, &other.return_ty) |
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.
Supports first layer of type semantics and goto def/ref/decl stuff. Does not yet support cast-checking or can-store semantics