Skip to content

Test: run the complete analyzer suite in syntax probes#1904

Open
Jim8y wants to merge 8 commits into
neo-project:master-n3from
Jim8y:jim8y/issue1841-probe-analyzer-suite
Open

Test: run the complete analyzer suite in syntax probes#1904
Jim8y wants to merge 8 commits into
neo-project:master-n3from
Jim8y:jim8y/issue1841-probe-analyzer-suite

Conversation

@Jim8y

@Jim8y Jim8y commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • run all 32 built-in contract analyzers for every syntax probe
  • keep analyzer errors visible alongside compiler diagnostics
  • cover analyzer-only restrictions in the syntax compatibility matrix

Why

The probe harness only ran UnsupportedSyntaxAnalyzer. Unsupported APIs and type restrictions handled by other analyzers could therefore be missed by the compatibility suite.

Validation

  • dotnet test tests/Neo.Compiler.CSharp.UnitTests/Neo.Compiler.CSharp.UnitTests.csproj --filter FullyQualifiedName~SyntaxTests --no-restore (139 passed)
  • targeted dotnet format --verify-no-changes

Part of #1841.

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.30%. Comparing base (487da8b) to head (78799f9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master-n3    #1904   +/-   ##
==========================================
  Coverage      84.30%   84.30%           
==========================================
  Files            308      308           
  Lines          28370    28370           
  Branches        4005     4005           
==========================================
  Hits           23917    23917           
  Misses          3457     3457           
  Partials         996      996           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jim8y
Jim8y marked this pull request as ready for review July 18, 2026 12:23
@Jim8y
Jim8y requested review from ajara87 and shargon July 18, 2026 18:14
ajara87
ajara87 previously approved these changes Jul 18, 2026
Comment thread tests/Neo.Compiler.CSharp.UnitTests/SyntaxProbes/Helper.cs Outdated
GetLoadableAnalyzerTypes()
.Where(type => !type.IsAbstract && typeof(DiagnosticAnalyzer).IsAssignableFrom(type))
.OrderBy(type => type.FullName, StringComparer.Ordinal)
.Select(type => (DiagnosticAnalyzer)Activator.CreateInstance(type)!)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
.Select(type => (DiagnosticAnalyzer)Activator.CreateInstance(type)!)
.Select(type =>
{
var instance = Activator.CreateInstance(type)
?? throw new InvalidOperationException($"Could not instantiate analyzer {type.FullName}. Ensure it has a public parameterless constructor.");
return (DiagnosticAnalyzer)instance;
})

Activator.CreateInstance(type)! suppresses nullability warnings but it can still return null at runtime (e.g., no accessible parameterless constructor). Add an explicit null check and throw a clear error message

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.

4 participants