Skip to content
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

Update for recent compiler changes for ref fields #73466

Merged
merged 5 commits into from
Aug 13, 2022

Conversation

cston
Copy link
Member

@cston cston commented Aug 5, 2022

@ghost
Copy link

ghost commented Aug 5, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

See dotnet/roslyn#62886.

Author: cston
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@stephentoub
Copy link
Member

stephentoub commented Aug 5, 2022

Are all of these changes necessary in order to successfully compile? If yes, this seems like a fairly significant breaking change, no? Or are these changes only necessary because of related places we're already using scoped?

@cston
Copy link
Member Author

cston commented Aug 5, 2022

Are all of these changes necessary in order to successfully compile?

Yes, these are changes needed to compile successfully. These are typically methods that have a ref parameter and another ref parameter of a ref struct type.

@@ -13,13 +13,13 @@ internal sealed class ArrayConverter<TCollection, TElement> : IEnumerableDefault
{
internal override bool CanHaveMetadata => false;

protected override void Add(in TElement value, ref ReadStack state)
protected override void Add(in TElement value, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped required here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Other than the comments questioning why certain categories of changes are needed, LGTM.

@@ -9,7 +9,7 @@ internal sealed class ConcurrentQueueOfTConverter<TCollection, TElement>
: IEnumerableDefaultConverter<TCollection, TElement>
where TCollection : ConcurrentQueue<TElement>
{
protected override void Add(in TElement value, ref ReadStack state)
protected override void Add(in TElement value, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped required here?

@@ -16,7 +16,7 @@ internal sealed class IDictionaryOfTKeyTValueConverter<TDictionary, TKey, TValue
where TDictionary : IDictionary<TKey, TValue>
where TKey : notnull
{
protected override void Add(TKey key, in TValue value, JsonSerializerOptions options, ref ReadStack state)
protected override void Add(TKey key, in TValue value, JsonSerializerOptions options, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped needed here?

@@ -17,13 +17,13 @@ internal sealed class IEnumerableConverter<TCollection>
{
private readonly bool _isDeserializable = typeof(TCollection).IsAssignableFrom(typeof(List<object?>));

protected override void Add(in object? value, ref ReadStack state)
protected override void Add(in object? value, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped needed here?

@@ -15,13 +15,13 @@ internal sealed class IEnumerableOfTConverter<TCollection, TElement>
{
private readonly bool _isDeserializable = typeof(TCollection).IsAssignableFrom(typeof(List<TElement>));

protected override void Add(in TElement value, ref ReadStack state)
protected override void Add(in TElement value, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped needed here?

@@ -9,7 +9,7 @@ internal sealed class ConcurrentStackOfTConverter<TCollection, TElement>
: IEnumerableDefaultConverter<TCollection, TElement>
where TCollection : ConcurrentStack<TElement>
{
protected override void Add(in TElement value, ref ReadStack state)
protected override void Add(in TElement value, scoped ref ReadStack state)
Copy link
Member

Choose a reason for hiding this comment

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

Why is scoped needed here?

@cston cston marked this pull request as ready for review August 11, 2022 18:17
@cston cston removed the blocked Issue/PR is blocked on something - see comments label Aug 11, 2022
@AaronRobinsonMSFT
Copy link
Member

I don't see any failures in the arm64 test. Looks like an infrastructure issue.

[15:05:31.5263400] 2022-08-12 15:05:31.506 System.Runtime.Tests[16226:178107346] Tests run: 49815 Passed: 49582 Inconclusive: 0 Failed: 0 Ignored: 137 Skipped: 96

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit 339a6bc into dotnet:main Aug 13, 2022
@cston cston deleted the more-ref-fields branch August 13, 2022 03:10
@ghost ghost locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants