-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix regression with var pattern nullability #53691
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ public TypeWithAnnotations ToTypeWithAnnotations(CSharpCompilation compilation, | |
if (Type?.IsTypeParameterDisallowingAnnotationInCSharp8() == true) | ||
{ | ||
var type = TypeWithAnnotations.Create(Type, NullableAnnotation.NotAnnotated); | ||
return State == NullableFlowState.MaybeDefault ? type.SetIsAnnotated(compilation) : type; | ||
return (State == NullableFlowState.MaybeDefault || asAnnotatedType) ? type.SetIsAnnotated(compilation) : type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this all that was needed to fix the 'foreach' scenario? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the |
||
} | ||
NullableAnnotation annotation = asAnnotatedType ? | ||
(Type?.IsValueType == true ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated) : | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,7 +442,7 @@ private ref TValue FindValue(TKey key) | |
ConcurrentOperation: | ||
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); | ||
ReturnFound: | ||
ref var value = ref entry._value; | ||
ref TValue value = ref entry._value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't clear to me why this needed to change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't bootstrap without this change |
||
Return: | ||
return ref value; | ||
ReturnNotFound: | ||
|
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.
📝 The issue was that
makeDagTempSlot
above was recording the type of thevar
pattern local intoState
, based on correct state (fromexpressionType
), but we'd drop that by usinginitialState
which captured a prior state.