Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private BoundExpression FinalTranslation(QueryTranslationState state, BindingDia
{
// The optimized form. We store the unoptimized form for analysis
unoptimizedForm = result;
result = MakeQueryInvocation(state.selectOrGroup, e, receiverIsCheckedForRValue: false, "GroupBy", lambdaLeft, diagnostics
result = MakeQueryInvocation(state.selectOrGroup, e, receiverIsCheckedForRValue: true, "GroupBy", lambdaLeft, diagnostics
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This receiver (e) is checked on line 263. I've re-audited the rest of the call sites of MakeQueryInvocation and didn't see any others that need to be updated.

#if DEBUG
, state.nextInvokedMethodName
#endif
Expand Down
17 changes: 17 additions & 0 deletions src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4786,5 +4786,22 @@ public static class F
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();
}
}
}
Loading