public void NullableStateLocalFunctions()
        {
            const int nFunctions = 2000;

            var builder = new StringBuilder();

            builder.AppendLine("#nullable enable");
            builder.AppendLine("class Program");
            builder.AppendLine("{");
            builder.AppendLine("    static void F(object arg)");
            builder.AppendLine("    {");
            for (int i = 0; i < nFunctions; i++)
            {
                builder.AppendLine($"        _ = F{i}(arg);");
                builder.AppendLine($"        static object F{i}(object arg{i}) => arg{i};");
            }
            builder.AppendLine("    }");
            builder.AppendLine("}");

            var source = builder.ToString();
            var comp   = CreateCompilation(source);
            var nullableAnalysisData = new NullableWalker.NullableAnalysisData();

            comp.TestOnlyCompilationData = nullableAnalysisData;
            comp.VerifyDiagnostics();

            var method = comp.GetMember("Program.F");

            Assert.Equal(1, nullableAnalysisData.Data[method].TrackedEntries);
        }
        public void AnalyzeMethodsInEnabledContextOnly()
        {
            const int nMethods = 10000;

            var builder = new StringBuilder();

            builder.AppendLine("static class Program");
            builder.AppendLine("{");
            for (int i = 0; i < nMethods; i++)
            {
                builder.AppendLine(i % 2 == 0 ? "#nullable enable" : "#nullable disable");
                builder.AppendLine($"    static object F{i}(object arg{i}) => arg{i};");
            }
            builder.AppendLine("}");

            var source = builder.ToString();
            var comp   = CreateCompilation(source);
            var nullableAnalysisData = new NullableWalker.NullableAnalysisData();

            comp.TestOnlyCompilationData = nullableAnalysisData;
            comp.VerifyDiagnostics();

            int analyzed = nullableAnalysisData.Data.Where(pair => pair.Value.RequiredAnalysis).Count();

            Assert.Equal(nMethods / 2, analyzed);
        }