Skip to content

Complete CLR interop support - #1309

Merged
nickna merged 2 commits into
mainfrom
feature/complete-clr-interop
Jul 28, 2026
Merged

Complete CLR interop support#1309
nickna merged 2 commits into
mainfrom
feature/complete-clr-interop

Conversation

@nickna

@nickna nickna commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • add closed generic CLR types and generic method inference across ordinary arguments, guest arrays, delegate callbacks, and contextual result types
  • support ref/out/in calls, CLR indexers, nullable value behavior, user-defined operators, compound/write-back operators, and extension-method imports
  • align interpreter, IL compiler, declaration generation, type checking, and language-server interop behavior
  • expand dual-mode CLR fixtures and documentation for the supported surface and remaining limitations

Validation

  • dotnet build SharpTS.sln --no-restore
  • focused CLR integration suite: 191/191 passed
  • shared generics/array/callback regression suite: 170/170 passed
  • git diff --check: clean

The full test suite was attempted during development but did not finish within the local execution window; it produced no failure output before timeout.

nickna added 2 commits July 27, 2026 18:16
ResolveTypeArg consulted DotNetTypeRegistry.ResolveFriendly before the
program's own generic parameters and class builders. That fallback scans
every assembly in the AppDomain for a bare type name, and compiled
TypeScript classes are public types in the global namespace under their
bare name, so a type argument naming a user class could bind to a
same-named type in an unrelated loaded assembly.

The emitted metadata then carried an assembly reference the compiled
program could not resolve, surfacing as

  FileNotFoundException: Could not load file or assembly 'test_<guid>'
     at $Program.Main()

Because it depends on which assemblies happen to be loaded, it presented
as an intermittent CI failure (GenericsTests.GenericClass_WithConstraint_Works
in compiled mode) that passed when run in isolation.

Move the scan below the generic-parameter and class arms, matching the
precedence ILCompiler.ResolveTypeArgument already uses and the rule
RegisterDotNetImportedType applies to dotnet: imports. Names still
reaching the scan are neither primitives, @DotNetType/dotnet: imports,
nor user classes, so explicit interop type arguments are unaffected.
@nickna
nickna merged commit 1eb5cfc into main Jul 28, 2026
2 checks passed
@nickna
nickna deleted the feature/complete-clr-interop branch July 28, 2026 02:24
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