Skip to content

Commit

Permalink
Address bootstrapping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed May 26, 2021
1 parent 12c2f04 commit 1ef2e51
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146808,5 +146808,32 @@ void M(T initial, System.Func<T, T?> selector)
var comp = CreateCompilation(src);
comp.VerifyDiagnostics();
}

[Theory, WorkItem(52925, "https://github.com/dotnet/roslyn/issues/52925")]
[InlineData("")]
[InlineData(" where T : notnull")]
[InlineData(" where T : class")]
[InlineData(" where T : class?")]
public void VarDeclarationWithGenericType_RefValue(string constraint)
{
var src = $@"
#nullable enable

class C<T> {constraint}
{{
ref T Passthrough(ref T value)
{{
ref var value2 = ref value;
return ref value2;
}}
}}
";
var comp = CreateCompilation(src);
comp.VerifyDiagnostics(
// (9,20): warning CS8619: Nullability of reference types in value of type 'T?' doesn't match target type 'T'.
// return ref value2;
Diagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, "value2").WithArguments("T?", "T").WithLocation(9, 20)
);
}
}
}
2 changes: 1 addition & 1 deletion src/Dependencies/Collections/SegmentedDictionary`2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Return:
return ref value;
ReturnNotFound:
Expand Down

0 comments on commit 1ef2e51

Please sign in to comment.