C#: Improve type attribution coverage on identifiers and declarations#6994
Merged
jkschneider merged 1 commit intomainfrom Mar 16, 2026
Merged
C#: Improve type attribution coverage on identifiers and declarations#6994jkschneider merged 1 commit intomainfrom
jkschneider merged 1 commit intomainfrom
Conversation
The C# parser was missing JavaType information on most identifier nodes. This adds type and fieldType attribution across ~30 identifier creation sites covering declarations, expressions, type references, and variable names. Also adds referential deduplication for JavaType.Variable via ISymbol-keyed caching, and a combined TypeAndFieldType() method to avoid redundant Roslyn API calls on expression identifiers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JavaTypeattribution to ~30 identifier creation sites in the C# parser that were previouslynull, nullVisitIdentifierNamefieldType,FieldAccessname,MethodInvocationname), variable declaration names (fields, locals, parameters, for/foreach, catch, pattern match, lambda params), and type references (non-primitive predefined types, generic raw type identifiers)FieldType(),TypeAndFieldType(), andRawType()methods toCSharpTypeMappingfor reference resolution, combined Roslyn API calls, and unparameterized generic type lookupJavaType.Variableinstances byISymbolinMapVariablefor referential deduplication across declaration and reference sitesTest plan
parseWithTypeAttributiontest passescomprehensiveTypeAttributiontest passes — verifies class/method/property/field type attributionCSharpRpcTestround-trip tests pass (no regressions)CSharpRecipeTestrecipe tests pass