Open jcouv opened 7 years ago
I suggest we relax implementation of HasAnyErrors helper to ignore errors caused by language version mismatch.
We should probably move language version checks out of the parser. However, when the language version affects the behavior of the parser (i.e. changes the tree produced) that should remain in the parser.
FYI @TyOverby since he's currently making changes in that area.
Repro:
using System;
public class C {
public void M(int x = default) {
}
}
Blocked on https://github.com/dotnet/roslyn/pull/19705
When binding the default value for parameter
x
invoid M(int x = default) {...}
with LangVersion=7, "default" ends up bound as aBoundBadExpression
. That's because of the logic below, which is sensitive to errors in the syntax tree. The proposal is to relax this logic, so that it ignores errors produced by LangVersion checks.@AlekseyTs can comment on the importance/priority of fixing this.
Relates to https://github.com/dotnet/roslyn/pull/20077#discussion_r120985019