Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Test and document Span breaking changes #75079

Conversation

jjonescz
Copy link
Member

Test plan: #73445

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 12, 2024
@jjonescz jjonescz marked this pull request as ready for review September 12, 2024 14:55
@jjonescz jjonescz requested a review from a team as a code owner September 12, 2024 14:55
@jjonescz jjonescz requested review from 333fred and cston September 12, 2024 14:55
@@ -0,0 +1,43 @@
# This document lists known breaking changes in Roslyn after .NET 8 all the way to .NET 9.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NET 8 all the way to .NET 9

Should this be ".NET 9 ... .NET 10"?

@@ -0,0 +1,43 @@
# This document lists known breaking changes in Roslyn after .NET 8 all the way to .NET 9.

## `Span` and `ReadOnlySpan` overloads are applicable in more scenarios in C# 14 and newer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Span and ReadOnlySpan

Consider including type parameters: "Span<T> and ReadOnlySpan<T>".

Assert.Equal(y.AsSpan(), s); // workaround
```

A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Span

Consider including the type parameter: Span<T>.

Assert.Equal(y.AsSpan(), s); // workaround
```

A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where an IEnumerable

Consider changing this to IEnumerable<T>, or generalize this to "a interface implemented by T[], such as IEnumerable<T>".

might be raised because a new overload is applicable but there is no single best overload.

The following example shows some ambiguities and possible workarounds.
Note that another workaround is for API authors to use `OverloadResolutionPriorityAttribute`.
Copy link
Member

@cston cston Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

"or for consumers to compile with -langversion:13 or earlier"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that's true for the whole section, not just these ambiguity examples. It should be implied by "C# 14 introduces...". It feels weird to suggest this workaround explicitly, we want people to upgrade langversions, not stay on old versions.

```

A `Span` overload might be chosen in C# 14 where an `IEnumerable` overload was chosen in C# 13,
and that can lead to `ArrayTypeMismatchException`s at runtime if you are using covariant arrays:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArrayTypeMismatchExceptions at runtime if you are using covariant arrays

Minor: Perhaps avoid the plural with "an ArrayTypeMismatchException at runtime if the array is covariant"

@jjonescz jjonescz merged commit 4d28028 into dotnet:features/FirstClassSpan Sep 16, 2024
24 checks passed
@jjonescz jjonescz deleted the FirstClassSpan-18-BreakingChanges branch September 16, 2024 08:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area-Compilers Feature - First-class Span Types untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants