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

Remove NonNullTypesOn/Off helper methods (#36105)

上级 10e0d220
......@@ -305,7 +305,7 @@ public void EmitAttribute_LocalFunctionConstraints()
var source = @"
class C
{
" + NonNullTypesOn() + @"
#nullable enable
void M1()
{
local(new C());
......@@ -329,7 +329,7 @@ public void EmitAttribute_LocalFunctionConstraints_Nested()
interface I<T> { }
class C
{
" + NonNullTypesOn() + @"
#nullable enable
void M1()
{
void local<T>(T t) where T : I<C?>
......@@ -351,7 +351,7 @@ public void EmitAttribute_LocalFunctionConstraints_NoAnnotation()
var source = @"
class C
{
" + NonNullTypesOn() + @"
#nullable enable
void M1()
{
local(new C());
......@@ -474,9 +474,9 @@ public void EmitAttribute_Interface_01()
public class A : I<object>
{
}
" + NonNullTypesOff() + @"
#nullable disable
public class AOblivious : I<object> { }
" + NonNullTypesOn() + @"
#nullable enable
public class B : I<object?>
{
}
......@@ -496,9 +496,9 @@ public class B : I<object?>
@"class C
{
static void F(I<object> x, I<object?> y) { }
" + NonNullTypesOff() + @"
#nullable disable
static void FOblivious(I<object> x) { }
" + NonNullTypesOn() + @"
#nullable enable
static void G(A x, B y, AOblivious z)
{
F(x, x);
......
......@@ -463,16 +463,6 @@ protected static CSharpCompilationOptions WithNonNullTypes(CSharpCompilationOpti
return (options ?? TestOptions.ReleaseDll).WithNullableContextOptions(nullableContextOptions);
}
protected static string NonNullTypesOff()
{
return "#nullable disable";
}
internal static string NonNullTypesOn()
{
return "#nullable enable";
}
internal CompilationVerifier CompileAndVerifyWithMscorlib40(
CSharpTestSource source,
IEnumerable<MetadataReference> references = null,
......
......@@ -20,7 +20,7 @@ internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProvider
private static readonly TestParameters s_nullableFeature = new TestParameters(parseOptions: new CSharpParseOptions(LanguageVersion.CSharp8));
private readonly string NonNullTypes = @"
" + Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBase.NonNullTypesOn() + @"
#nullable enable
";
[Fact]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册