UseDeepCloning generate Dictionary<string?, xxx> when mapping from nullable disable class file #1615
Open
3 tasks done
Labels
bug
Something isn't working
Describe the bug
The source generator does not respect generic type parameter constraint
notnull
on DictionaryTKey
when mapping a class with#nullable disable
Instead of
Dictionary<string?, xxx>
, it should generateDictionary<string, int>
Declaration code
Actual relevant generated code
Expected relevant generated code
Reported relevant diagnostics
Argument of type 'Dictionary<string, int>' cannot be used for parameter 'source' of type 'IReadOnlyDictionary<string?, int>' in 'Dictionary<string?, int> DataMapper.MapToDictionaryOfStringAndInt32(IReadOnlyDictionary<string?, int> source)' due to differences in the nullability of reference types.
The type 'string?' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'string?' doesn't match 'notnull' constraint.
Environment (please complete the following information):
enable
The text was updated successfully, but these errors were encountered: