Made parser warnings use Error info
no other warn calls were found, which have position information Change-Id: If9773b86a756e5b2e4096d3f6b3a5114bfed5bee
This commit is contained in:
@@ -755,12 +755,15 @@ template<> struct BuildAST<grammar::v1::expr::ancient_let> : change_head<Binding
|
||||
// Added 2024-09-18. Turn into an error at some point in the future.
|
||||
// See the documentation on deprecated features for more details.
|
||||
if (!ps.featureSettings.isEnabled(Dep::AncientLet))
|
||||
warn(
|
||||
"%s found at %s. This feature is deprecated and will be removed in the future. Use %s to silence this warning.",
|
||||
"let {",
|
||||
ps.positions[ps.at(in)],
|
||||
"--extra-deprecated-features ancient-let"
|
||||
);
|
||||
//FIXME: why aren't there any tests for this?
|
||||
logWarning({
|
||||
.msg = HintFmt(
|
||||
"%s is deprecated and will be removed in the future. Use %s to silence this warning.",
|
||||
"let {",
|
||||
"--extra-deprecated-features ancient-let"
|
||||
),
|
||||
.pos = ps.positions[ps.at(in)]
|
||||
});
|
||||
|
||||
auto pos = ps.at(in);
|
||||
b.set.pos = pos;
|
||||
|
||||
+17
-18
@@ -85,35 +85,34 @@ inline void State::dupAttr(Symbol attr, const PosIdx pos, const PosIdx prevPos)
|
||||
inline void State::overridesFound(const PosIdx pos) {
|
||||
// Added 2024-09-18. Turn into an error at some point in the future.
|
||||
// See the documentation on deprecated features for more details.
|
||||
warn(
|
||||
"%s found at %s. This feature is deprecated and will be removed in the future. Use %s to silence this warning.",
|
||||
"__overrides",
|
||||
positions[pos],
|
||||
"--extra-deprecated-features rec-set-overrides"
|
||||
);
|
||||
logWarning({
|
||||
.msg = HintFmt(
|
||||
"%s attributes are deprecated and will be removed in the future. Use %s to silence this warning.",
|
||||
"__overrides",
|
||||
"--extra-deprecated-features rec-set-overrides"
|
||||
),
|
||||
.pos = positions[pos],
|
||||
});
|
||||
}
|
||||
|
||||
// Added 2025-02-05. This is unlikely to ever occur in the wild, given how broken it is
|
||||
inline void State::badLineEndingFound(const PosIdx pos, bool warnOnly)
|
||||
{
|
||||
ErrorInfo ei = {
|
||||
.msg = HintFmt(
|
||||
"CR (`\\r`) and CRLF (`\\r\\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\\n`) line endings instead. Use %s to silence this warning.",
|
||||
"--extra-deprecated-features cr-line-endings"
|
||||
),
|
||||
.pos = positions[pos],
|
||||
};
|
||||
// Within strings we should throw because it is a correctness issue, outside of
|
||||
// strings it only harmlessly fucks up line numbers in error messages so warning is sufficient.
|
||||
if (warnOnly) {
|
||||
if (!hasWarnedAboutBadLineEndings)
|
||||
warn(
|
||||
"CR (`\\r`) and CRLF (`\\r\\n`) line endings found at %s. Please inspect the file and normalize it to use LF (`\\n`) line endings instead. Use %s to silence this warning.",
|
||||
positions[pos],
|
||||
"--extra-deprecated-features cr-line-endings"
|
||||
);
|
||||
logWarning(ei);
|
||||
hasWarnedAboutBadLineEndings = true;
|
||||
} else
|
||||
throw ParseError({
|
||||
.msg = HintFmt(
|
||||
"CR (`\\r`) and CRLF (`\\r\\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\\n`) line endings instead. Use %s to silence this warning.",
|
||||
"--extra-deprecated-features cr-line-endings"
|
||||
),
|
||||
.pos = positions[pos],
|
||||
});
|
||||
throw ParseError(ei);
|
||||
}
|
||||
// Added 2025-02-05.
|
||||
inline void State::nulFound(const PosIdx pos)
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
warning: CR (`\r`) and CRLF (`\r\n`) line endings found at «stdin»:7:21. Please inspect the file and normalize it to use LF (`\n`) line endings instead. Use --extra-deprecated-features cr-line-endings to silence this warning.
|
||||
warning: CR (`\r`) and CRLF (`\r\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\n`) line endings instead. Use --extra-deprecated-features cr-line-endings to silence this warning.
|
||||
at «stdin»:7:21:
|
||||
6| x =
|
||||
7| # Dit is een test.
|
||||
| ^
|
||||
8| y;
|
||||
error: CR (`\r`) and CRLF (`\r\n`) line endings are not supported. Please inspect the file and normalize it to use LF (`\n`) line endings instead. Use --extra-deprecated-features cr-line-endings to silence this warning.
|
||||
at «stdin»:14:15:
|
||||
13| # translated to LF.
|
||||
|
||||
@@ -1,2 +1,12 @@
|
||||
warning: __overrides found at «stdin»:3:16. This feature is deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
|
||||
warning: __overrides found at «stdin»:4:8. This feature is deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
|
||||
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
|
||||
at «stdin»:3:16:
|
||||
2| # Should warn
|
||||
3| { a = rec {}; a.__overrides = {}; }
|
||||
| ^
|
||||
4| rec { __overrides = {}; }
|
||||
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
|
||||
at «stdin»:4:8:
|
||||
3| { a = rec {}; a.__overrides = {}; }
|
||||
4| rec { __overrides = {}; }
|
||||
| ^
|
||||
5| # Should not warn: Not recursive
|
||||
|
||||
Reference in New Issue
Block a user