libexpr: Deprecate or in non-keyword positions
Test cases courtesy of rhenrdic Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems> Change-Id: Id8df684ddd00d07b49e1c9e68bf41ee6c0e6887c
This commit is contained in:
co-authored by
Commentator2.0
parent
af166146ff
commit
17f1bcfd2c
@@ -42,6 +42,8 @@ struct State
|
||||
void nulFound(const PosIdx pos);
|
||||
void recSetMergeFound(const AttrPath & attrPath, const PosIdx pos);
|
||||
void recSetDynamicAttrFound(const PosIdx pos);
|
||||
void orIdentifierFound(const PosIdx pos);
|
||||
void orArgumentFound(const PosIdx pos);
|
||||
void addAttr(ExprAttrs * attrs, AttrPath && attrPath, std::unique_ptr<Expr> e, const PosIdx pos);
|
||||
void mergeAttrs(AttrPath & attrPath, ExprSet * source, ExprSet * target);
|
||||
void validateLambdaAttrs(AttrsPattern & pattern, PosIdx pos = noPos);
|
||||
@@ -198,6 +200,34 @@ inline void State::recSetDynamicAttrFound(const PosIdx pos)
|
||||
});
|
||||
}
|
||||
|
||||
// Added 2026-01-30
|
||||
inline void State::orIdentifierFound(const PosIdx pos)
|
||||
{
|
||||
logWarning({
|
||||
.msg = HintFmt(
|
||||
"using %s as an identifier is deprecated because it cannot be used in most places (try "
|
||||
"%s). Use %s to disable this warning.",
|
||||
"or",
|
||||
"let or = 1; in or",
|
||||
"--extra-deprecated-features or-as-identifier"
|
||||
),
|
||||
.pos = positions[pos],
|
||||
});
|
||||
}
|
||||
// Added 2026-01-30
|
||||
inline void State::orArgumentFound(const PosIdx pos)
|
||||
{
|
||||
logWarning({
|
||||
.msg = HintFmt(
|
||||
"using %s as an argument is deprecated because it is parsed with the wrong precedence "
|
||||
"which may cause unexpected behavior. Use %s to disable this warning.",
|
||||
"or",
|
||||
"--extra-deprecated-features or-as-identifier"
|
||||
),
|
||||
.pos = positions[pos],
|
||||
});
|
||||
}
|
||||
|
||||
inline void State::addAttr(ExprAttrs * attrs, AttrPath && attrPath, std::unique_ptr<Expr> e, const PosIdx pos)
|
||||
{
|
||||
AttrPath::iterator i;
|
||||
|
||||
Reference in New Issue
Block a user