-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS-153: Enable TypesProcessor to Process Dictionaries #77
base: main
Are you sure you want to change the base?
Conversation
SyntaxFactory.Identifier("List"), | ||
SyntaxFactory.TypeArgumentList(SyntaxFactory.SeparatedList(new[] { underlyingTypeSyntax }))); | ||
var underlyingTypeSyntaxes = namedTypeSymbol.TypeArguments.Select(typeArgument => CreateTypeSyntaxForSymbol(typeArgument)); | ||
var collectionIdentifier = namedTypeSymbol.TypeArguments.Length switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a better collection identification here.
What if it's MyCustomList<A,B> : IList<A>
(probably good idea to add tests).
Let's determine the collection type by the actual type: Dictionary, IDictionary => Dictionary, List ... => List
public class CustomEnumerableHolder | ||
{ | ||
public CustomIEnumerable<int> Enumerable1 { get; set; } | ||
public CustomIEnumerable<EnumerableHolder> Enumerable2 { get; set; } | ||
} | ||
|
||
public class CustomIDictionary<TKey, TValue> : IDictionary<TKey, TValue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add also ISet, Queue, Stack, just to be on the safe side.
@@ -253,4 +253,18 @@ private static (NodeType NodeType, INamedTypeSymbol NamedSymbol, SyntaxNode Expr | |||
|
|||
return (nodeType, namedType, expressionNode); | |||
} | |||
|
|||
private static bool ProcessTypeArguments(IEnumerable<ITypeSymbol> typeArguments, TypesProcessor typesProcessor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could simplify with
namedType.TypeArguments.All(t => typesProcessor.ProcessTypeSymbol(t) != null)
Maybe no need for the helper method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
public void CustomDictionaries() | ||
{ | ||
_ = GetMongoQueryable<CustomDictionariesHolder>().Where(t => | ||
t.IntDictionary["key"] == 1 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Enable TypesProcessor to Process Dictionaries