mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 05:11:09 +00:00
Fix a desugaring bug
This commit is contained in:
parent
48f91f969b
commit
e9d0642b29
2 changed files with 18 additions and 1 deletions
|
@ -1979,7 +1979,13 @@ impl fmt::Display for TypeSpec {
|
||||||
}
|
}
|
||||||
write!(f, "}}")
|
write!(f, "}}")
|
||||||
}
|
}
|
||||||
Self::Enum(elems) => write!(f, "{{{elems}}}"),
|
Self::Enum(elems) => {
|
||||||
|
write!(f, "{{")?;
|
||||||
|
for elem in elems.pos_args() {
|
||||||
|
write!(f, "{}, ", elem.expr)?;
|
||||||
|
}
|
||||||
|
write!(f, "}}")
|
||||||
|
}
|
||||||
Self::Interval { op, lhs, rhs } => write!(f, "{lhs}{}{rhs}", op.inspect()),
|
Self::Interval { op, lhs, rhs } => write!(f, "{lhs}{}{rhs}", op.inspect()),
|
||||||
Self::Subr(s) => write!(f, "{s}"),
|
Self::Subr(s) => write!(f, "{s}"),
|
||||||
Self::TypeApp { spec, args } => write!(f, "{spec}{args}"),
|
Self::TypeApp { spec, args } => write!(f, "{spec}{args}"),
|
||||||
|
|
|
@ -992,6 +992,17 @@ impl Desugarer {
|
||||||
insertion_idx += 1;
|
insertion_idx += 1;
|
||||||
insertion_idx
|
insertion_idx
|
||||||
}
|
}
|
||||||
|
ParamPattern::Lit(l) => {
|
||||||
|
let lit = l.clone();
|
||||||
|
sig.pat = ParamPattern::Discard(Token::new(
|
||||||
|
TokenKind::UBar,
|
||||||
|
"_",
|
||||||
|
l.ln_begin().unwrap(),
|
||||||
|
l.col_begin().unwrap(),
|
||||||
|
));
|
||||||
|
sig.t_spec = Some(TypeSpecWithOp::new(COLON, TypeSpec::enum_t_spec(vec![lit])));
|
||||||
|
insertion_idx
|
||||||
|
}
|
||||||
_ => insertion_idx,
|
_ => insertion_idx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue