Skip to content

Have compiler return semantic errors in lambdas even in the presence of syntax errors #1867

Closed
@jmarolf

Description

Today, the compiler does not return semantic errors inside lambdas in the IDE if there are syntax errors. This causes several quick fix scenarios to fail inside lambdas (for example #1239, #1241, and #1744 are all caused by this problem).

Consider the code sample below from issue #1239:

using System.Threading.Tasks;

class C {
    C() {
        Task.Run(() => {
            new C(0)
        });
    }
}

new C(0) will never be squiggled by the IDE because of the lack of a semicolon. This makes quick-fixes that could generate a constructor unable to run because there is no error to trigger them.

By having the compiler return semantic errors in lambdas even in the presence of syntax errors, many more IDE scenarios will "Just Work"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

4 - In ReviewA fix for the issue is submitted for review.Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.Concept-Diagnostic ClarityThe issues deals with the ease of understanding of errors and warnings.Feature RequestLanguage-C#

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions