Skip to content

Provide resolution diagnostics (inline) [rebased on main]#610

Draft
Morriar wants to merge 12 commits intomainfrom
at-resolver-diagnostics-inline-v2
Draft

Provide resolution diagnostics (inline) [rebased on main]#610
Morriar wants to merge 12 commits intomainfrom
at-resolver-diagnostics-inline-v2

Conversation

@Morriar
Copy link
Contributor

@Morriar Morriar commented Feb 27, 2026

Rebased version of #502 on top of current main.

Summary

Adds resolution diagnostics that are emitted inline during resolution (rather than in a post-processing pass):

  • KindRedefinition — redefining a constant as a different kind (e.g., class → module)
  • ParentRedefinition — redefining a class's superclass
  • NonClassSuperclass — using a non-class as a superclass
  • CircularDependency — circular inheritance or mixin chains
  • NonModuleMixininclude/prepend with a non-module
  • UnresolvedConstantReference — constant references that can't be resolved

Changes from #502

  • Rebased onto main (144 commits ahead)
  • Adapted to renamed Unit::ConstantRef (was Unit::Reference)
  • Fixed DefinitionKind and DeclarationKind extraction (now enums, not &str)
  • Added deduplication in add_diagnostic and linearize_mixins to prevent duplicate emissions during ancestor retry loops
  • Skip synthetic singleton class names (<Foo>) when emitting unresolved constant reference diagnostics
  • Updated tests that were added to main after the original branch diverged

@Morriar Morriar requested a review from a team as a code owner February 27, 2026 14:38
@Morriar Morriar marked this pull request as draft February 27, 2026 14:39
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
- Add PartialOrd/Ord derives to DefinitionKind (required for .cmp() in orphan_report)
- Fix orphan_report.rs to use typed DefinitionKind enum instead of string literals
- Fix add_diagnostic to deduplicate (prevents duplicate emissions on retry)
- Fix linearize_mixins extend to also deduplicate diagnostics
- Fix unit_queue: use self.unit_queue consistently; rename Unit::Reference → Unit::ConstantRef
- Skip synthetic singleton class names (<Foo>) in unresolved constant reference drain loop
- Update tests that were added to main after the original branch diverged
Add as_api_str() to DeclarationKind for PascalCase API names (Class, Module, etc.)
and update server.rs to use it instead of treating kind() as &str.
@Morriar Morriar force-pushed the at-resolver-diagnostics-inline-v2 branch from bc97613 to 47c9266 Compare February 27, 2026 16:57
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.

1 participant