Allow duplicated switch cases.

This commit is contained in:
Stephen Chung
2022-07-18 13:40:41 +08:00
parent 4b760d1d0f
commit 7dca916c45
9 changed files with 235 additions and 145 deletions

View File

@@ -97,6 +97,14 @@ pub enum ParseErrorType {
/// A map definition has duplicated property names. Wrapped value is the property name.
DuplicatedProperty(String),
/// A `switch` case is duplicated.
///
/// # Deprecated
///
/// This error variant is deprecated. It never occurs and will be removed in the next major version.
#[deprecated(
since = "1.9.0",
note = "This error variant is deprecated. It never occurs and will be removed in the next major version."
)]
DuplicatedSwitchCase,
/// A variable name is duplicated. Wrapped value is the variable name.
DuplicatedVariable(String),
@@ -211,6 +219,7 @@ impl fmt::Display for ParseErrorType {
Self::FnDuplicatedParam(s, arg) => write!(f, "Duplicated parameter {} for function {}", arg, s),
Self::DuplicatedProperty(s) => write!(f, "Duplicated property for object map literal: {}", s),
#[allow(deprecated)]
Self::DuplicatedSwitchCase => f.write_str("Duplicated switch case"),
Self::DuplicatedVariable(s) => write!(f, "Duplicated variable name: {}", s),