Skip to content

Remove checks for impossible conditions from Microsoft.CSharp #22868

@JonHanna

Description

@JonHanna

dotnet/corefx#22456 removed some error codes that were never used, but there is other code in Microsoft.CSharp that checks for conditions that are irrelevant (can only happen when defining a type, constant operations, or other cases that only come up in static code) or impossible (lacking a mscorlib, types like int and object aren't available, in which case there would have been a fatal error before the code had a chance to run).

The removal of this dead code of course needs to be careful of removing a condition that actually could happen, in which case a test cases that hit it should be added or if that's difficult for some reason the condition should be clearly documented in a comment.

This issue is to track that.

The following is a list of all errors not currently hit during testing. This isn't a perfect to-do list (the same error could have both possible and impossible paths to it) and it includes some cases that I think should definitely be reachable (but they should be covered by tests anyway for #19616 and marked off as soon as confirmed as reachable, and besides I could be wrong), but it will serve as a gauge. There could also be cases that cannot be hit but should be, as per dotnet/corefx#22534)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions