Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a dedicated platform exception type for non-exhaustive switch expression #27747

Closed
gafter opened this issue Jun 12, 2018 · 3 comments
Closed

Comments

@gafter
Copy link
Member

gafter commented Jun 12, 2018

When a switch expression doesn't have a matching arm at runtime, we need an exception to throw.

@gafter
Copy link
Member Author

gafter commented Nov 6, 2018

Something like

namespace System
{
    /// <summary>
    /// Indicates that a switch expression that was non-exhaustive failed to match its input.
    /// </summary>
    [System.Runtime.InteropServices.ComVisible(true)]
    [Serializable]
    public class MatchFailureException : System.ArgumentException
    {
        public MatchFailureException() { }
    }
}

@jcouv
Copy link
Member

jcouv commented Nov 6, 2018

@gafter Please open a corefx issue for design review (something like https://github.com/dotnet/corefx/issues/21809).

@gafter
Copy link
Member Author

gafter commented Nov 13, 2018

The corefx issue for this is https://github.com/dotnet/corefx/issues/33284

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

No branches or pull requests

2 participants