Skip to content

Type system first draft - #232

Open
JonatanWaern wants to merge 8 commits into
mainfrom
type-system
Open

JonatanWaern wants to merge 8 commits into
mainfrom
type-system

Conversation

@JonatanWaern

Copy link
Copy Markdown
Contributor

Supports first layer of type semantics and goto def/ref/decl stuff. Does not yet support cast-checking or can-store semantics

  • Rename variants of basetypecontent
  • Lookup tests for types
  • Fix bug in template cycle detection
  • Type system semantics
  • Allow vect declarations in cdecl modifiers

Makes the naming slightly more consistent
Signed-off-by: Jonatan Waern

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/actions/semantic_lookup.rs Outdated
Comment thread src/analysis/mod.rs
Comment thread src/analysis/structure/types.rs Outdated
Comment thread src/analysis/structure/types.rs Outdated
Comment thread src/analysis/structure/types.rs Outdated
Comment thread src/analysis/templating/types.rs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/actions/semantic_lookup.rs Outdated
Comment thread src/analysis/mod.rs
Comment thread src/analysis/templating/types.rs Outdated
Comment thread src/analysis/templating/types.rs
Comment thread src/analysis/templating/types.rs Outdated
Comment thread tests/test_files/errors_unknown_type.dml Outdated
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment on lines +479 to +483
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); }
_ => {}
}
Comment thread src/analysis/mod.rs
Comment on lines +2295 to +2299
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| {
Comment on lines +1080 to +1081
for arg in &arguments {
if let MethodArgument::Typed(_, UnresolvedType::Struct(s)) = arg {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants