未验证 提交 3f9c5ef8 编写于 作者: C Charles Stoner 提交者: GitHub

Ensure TypeSymbolWithAnnotations.IsNullable != null for value type (#28298)

上级 1de4314e
......@@ -566,7 +566,7 @@ public bool ApplyNullableTransforms(ImmutableArray<bool> transforms, bool useNon
result = result.DoUpdate(newTypeSymbol, result.CustomModifiers);
}
//if (!result.IsValueType) // PROTOTYPE(NullableReferenceTypes): this is causing cycle 6 in NullableAttribute_01
if (!result.IsValueType)
{
if (isNullable)
{
......
......@@ -1863,6 +1863,21 @@ public class Oblivious { }
VerifyNonNullTypes(obliviousComp.GetMember("Oblivious"), true); // PROTOTYPE(NullableReferenceTypes): should be false
}
[Fact]
public void NonNullTypes_ValueTypeArgument()
{
var source =
@"using System.Runtime.CompilerServices;
[module: NonNullTypes(false)]
class A<T> { }
class B
{
A<byte> P { get; }
}";
var comp = CreateCompilation(new[] { source, NonNullTypesAttributesDefinition }, parseOptions: TestOptions.Regular8);
comp.VerifyDiagnostics();
}
[Fact]
public void AssignObliviousIntoLocals()
{
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册