dotnet/roslyn
Auf GitHub ansehenGeneralize `(CollectionBuilderType<T>)[..readOnlySpan]` optimization to spread operands which are implicitly convertible to `ReadOnlySpan<T>`
Open
#73.110 geöffnet am 19. Apr. 2024
Area-CompilersCode Gen QualityFeature - Collection Expressionshelp wanted
Repository-Metriken
- Stars
- (20.414 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)
Beschreibung
I would welcome a follow-up PR which also handles cases where the spread operand is implicitly convertible to
ReadOnlySpan<T>.
Originally posted by @RikkiGibson in https://github.com/dotnet/roslyn/issues/73102#issuecomment-2067272169
Affected scenarios would include:
Span<int> span = ..;
MyCollectionBuilderType<T> collection = [..span];
// currently:
MyCollectionBuilderType<T> collection = MyCollectionBuilderType.Create((ReadOnlySpan<T>)span.ToArray());
// could change to:
MyCollectionBuilderType<T> collection = MyCollectionBuilderType.Create((ReadOnlySpan<T>)span);