Repository: dotnet/roslyn
File: src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs (C#)

Code before:
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80008")]
        public void PropertyAccess_Static()
        {
            var code = """
                using System.Linq;

                var r = from string s in F.M from string s2 in F.M2 select s.ToString();
                foreach (var x in r)
                {
                    System.Console.Write(x.ToString());
                }

                public static class F
                {
                    public static object[] M => ["ran"];
                    public static object[] M2 => [""];
                }
                """;

            var comp = CreateCompilation(code);
            CompileAndVerify(code, expectedOutput: "ran").VerifyDiagnostics();
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80008")]
        public void PropertyAccess_AnonymousType_GroupBy()
        {
            var code = """
                using System.Linq;

                var x = new { A = new[] { new { B = 1 } } };

                var y = from a in x.A
                        group a by a.B into g
                        select 1;
                """;

            var comp = CreateCompilation(code);
            comp.VerifyDiagnostics();
        }
    }
}


Review comment (suggestion):
```suggestion
        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81709")]
```

Code after:
                // (6,12): error CS8332: Cannot assign to a member of field 'V' or use it as the right hand side of a ref assignment because it is a readonly variable
                //     select r.V.F++;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "r.V.F").WithArguments("field", "V").WithLocation(6, 12));
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80008")]
        public void PropertyAccess_Instance()
        {
            var code = """
                using System.Linq;

                var f = new F();
                var r = from string s in f.M from string s2 in f.M2 select s.ToString();
                foreach (var x in r)
                {
                    System.Console.Write(x.ToString());
                }

                public class F
                {
                    public object[] M => ["ran"];
                    public object[] M2 => [""];
                }
                """;

            var comp = CreateCompilation(code);
            CompileAndVerify(code, expectedOutput: "ran").VerifyDiagnostics();
        }

        [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80008")]
        public void PropertyAccess_Static()
        {
            var code = """
                using System.Linq;

                var r = from string s in F.M from string s2 in F.M2 select s.ToString();
                foreach (var x in r)
                {
                    System.Console.Write(x.ToString());
                }

                public static class F
                {
                    public static object[] M => ["ran"];
                    public static object[] M2 => [""];
                }
                """;

            var comp = CreateCompilation(code);
            CompileAndVerify(code, expectedOutput: "ran").VerifyDiagnostics();
        }