Skip to content

feat: add loom-config Debug flag, centralize debug diagnostics#61

Merged
R-unic merged 1 commit into
masterfrom
feat/centralize-debug-diagnostics
Jul 24, 2026
Merged

feat: add loom-config Debug flag, centralize debug diagnostics#61
R-unic merged 1 commit into
masterfrom
feat/centralize-debug-diagnostics

Conversation

@R-unic

@R-unic R-unic commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • TypeChecker.EmitDebugDiagnostics was a public static mutable bool that was never set anywhere in the codebase — debug diagnostics could literally never fire. Removed it.
  • Added LoomConfig.Debug (debug = true in loom-config.toml).
  • Centralized behind SemanticModel.EmitDebugDiagnostics, set once by Resolver from the compilation unit's config, and read by both Resolver and TypeChecker from the same shared SemanticModel instead of a scattered static.
  • Wired Loom.CLI/Program.cs to pass debugDiagnostics: loomConfig.Debug instead of a hardcoded false, so the flag actually does something end-to-end.
  • Resolver.DeclareSymbol used to emit up to 3 separate debug diagnostics per declared symbol ("Declared symbol: X", "X is global", "X is intrinsic"). Consolidated into one message per declaration, e.g. Declared 'Foo' (Interface) [global, ambient, intrinsic].
  • Debug-severity diagnostics now render as a compact one-line message (debug [file @ line:col] message) instead of the full multi-line source-frame every other severity uses — appropriate for what's meant to be high-volume trace output. Error/Warn/Info rendering is unchanged.

Test plan

  • dotnet build — succeeds, no warnings
  • dotnet test — 1817/1817 pass
  • Verified end-to-end: a real loom-config.toml with debug = true now prints compact debug diagnostics for every declared symbol and solved type; without the flag (or debug = false), output is unchanged from before ((none))

🤖 Generated with Claude Code

TypeChecker.EmitDebugDiagnostics was a public static bool that nothing
in the codebase ever set, so debug diagnostics could never fire. Adds
LoomConfig.Debug (debug = true in loom-config.toml), threaded through
SemanticModel.EmitDebugDiagnostics (set by Resolver from the
compilation unit's config) instead of a dead static, and wired into
Loom.CLI so setting debug = true actually surfaces them.

Resolver.DeclareSymbol used to emit up to three separate debug
diagnostics per declared symbol (declared/global/intrinsic); these are
now one consolidated message with a flag suffix, e.g. "Declared 'Foo'
(Interface) [global, ambient, intrinsic]".

Debug-severity diagnostics now render as a compact one-line message
instead of the full multi-line source-frame every other severity uses
- appropriate for what's meant to be high-volume trace output.
@R-unic
R-unic merged commit 0052d2f into master Jul 24, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Loom Release 1.0.0 Jul 24, 2026
@R-unic
R-unic deleted the feat/centralize-debug-diagnostics branch July 24, 2026 10:39
@github-actions

Copy link
Copy Markdown

Qodana for .NET

251 new problems were found

Inspection name Severity Problems
Auto-property accessor is never used (private accessibility) 🔶 Warning 6
Auto-property accessor is never used (non-private accessibility) 🔶 Warning 5
Non-accessed positional property (non-private accessibility) 🔶 Warning 2
Redundant name qualifier 🔶 Warning 1
Type member is never used (private accessibility) 🔶 Warning 1
Unused local variable 🔶 Warning 1
Type member is never used (non-private accessibility) ◽️ Notice 94
Use preferred style of 'new' expression when created type is not evident ◽️ Notice 83
Member can be made private (non-private accessibility) ◽️ Notice 20
Class is never instantiated (non-private accessibility) ◽️ Notice 4
Invert 'if' statement to reduce nesting ◽️ Notice 4
Some values of the enum are not processed inside 'switch' statement ◽️ Notice 4
Use preferred style for trailing comma before new line in multiline lists ◽️ Notice 3
Auto-property can be made get-only (non-private accessibility) ◽️ Notice 3
RoslynAnalyzers The member referenced by the MemberData attribute returns untyped data rows ◽️ Notice 3
RoslynAnalyzers Do not use Enumerable methods on indexable collections ◽️ Notice 2
Property can be made init-only (non-private accessibility) ◽️ Notice 2
Auto-property can be made get-only (private accessibility) ◽️ Notice 1
RoslynAnalyzers Use concrete types when possible for improved performance ◽️ Notice 1
RoslynAnalyzers Use char overload ◽️ Notice 1
'if-return' statement can be rewritten as 'return' statement ◽️ Notice 1
Foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used ◽️ Notice 1
Merge null/pattern checks into complex pattern ◽️ Notice 1
Redundant string interpolation ◽️ Notice 1
Replace with 'field' keyword ◽️ Notice 1
Some values of the enum are not processed inside 'switch' statement and are handled via default section ◽️ Notice 1
Tail recursive call can be replaced with loop ◽️ Notice 1
Type member is never accessed via base type (non-private accessibility) ◽️ Notice 1
Method return value is never used (non-private accessibility) ◽️ Notice 1
Literal length can be reduced by using verbatim string ◽️ Notice 1

☁️ View the detailed Qodana report

Detected 1 dependency

Third-party software list

This page lists the third-party software dependencies used in Loom

Dependency Version Licenses
Tomlyn 2.6.0 BSD-2-Clause
Contact Qodana team

Contact us at qodana-support@jetbrains.com

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