Repository navigation
[feature/damAnalyzer] Enable a few linker DAM tests for analyzer - #2307
Conversation
Also add a few testcases demonstrating an issue uncovered in some of the tests from MethodReturnParameterDataFlow.
| parameterOptions: SymbolDisplayParameterOptions.IncludeType | ||
| ); | ||
|
|
||
| public static string GetDisplayName (this ISymbol symbol) |
There was a problem hiding this comment.
Should we have an interface in ILLinkShared to make clearer the fact that things deriving from IMetadataTokenProvider or ISymbol should implement GetDisplayName? This also makes me wonder if we should share tests in GetDisplayNameTests (unrelated to this PR though).
There was a problem hiding this comment.
I'd love to share more code and tests! I gave it some thought but don't see a great way to share more of the display name code (or even interfaces). Even if we could implement interfaces for foreign types we'd need to specialize the implementation for different IMetadataTokenProvirders since the interface doesn't provide enough information to format a display name. Ideas welcome!
| public static string GetStringFromExpression (TypeOfExpressionSyntax expr, SemanticModel semanticModel, SymbolDisplayFormat displayFormat) | ||
| { | ||
| var typeSymbol = semanticModel.GetSymbolInfo (expr.Type).Symbol; | ||
| return typeSymbol?.ToDisplayString (displayFormat) ?? throw new InvalidOperationException (); | ||
| } |
There was a problem hiding this comment.
Should we add displayFormat as an optional parameter to the bellow method and put these two lines there?
There was a problem hiding this comment.
I made them separate because I don't think there's an obvious way to give a string representation of an expression in general. I'd rather limit the below method to expressions which are building up strings from literals, and have separate variants used to format types (or maybe other kinds in the future).
mateoatr
left a comment
There was a problem hiding this comment.
LGTM. Just minor comments.
- Skip failing tests
…net/linker#2307) * Format parameters with spaces * Fix field formatting an DAM tests * Turn on a few linker DAM tests for analyzer * Add missing using * Fix formatting * FIx typo and enable more tests Also add a few testcases demonstrating an issue uncovered in some of the tests from MethodReturnParameterDataFlow. * PR feedback - Skip failing tests Commit migrated from dotnet/linker@6e0ff21
This turns on a few of the basic testcases for DAM analysis that don't require dataflow. I changed the signature format slightly because Roslyn formats methods with spaces separating parameters by default. I also changed the field signature format to use a format consistent with methods.