From c8603fd3e242633c80f2890a5ef984f589a913c4 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Mon, 18 Sep 2023 16:48:23 +0800 Subject: [PATCH] nixd/Syntax: deprecated notes for URL literal --- nixd/lib/Syntax/Parser/Parser.y | 6 ++++++ nixd/tools/nixd-lint/test/url-literal.nix | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 nixd/tools/nixd-lint/test/url-literal.nix diff --git a/nixd/lib/Syntax/Parser/Parser.y b/nixd/lib/Syntax/Parser/Parser.y index a480488e2..e7ea5be7e 100644 --- a/nixd/lib/Syntax/Parser/Parser.y +++ b/nixd/lib/Syntax/Parser/Parser.y @@ -401,6 +401,12 @@ uri : URI { $$ = decorateNode(new nixd::syntax::URI, *yylocp, *Data); $$->S = std::string($1); + + Diagnostic Diag; + Diag.Msg = "URL literal is deprecated"; + Diag.Kind = Diagnostic::Warning; + Diag.Range = $$->Range; + Data->Diags.emplace_back(std::move(Diag)); } identifier_or diff --git a/nixd/tools/nixd-lint/test/url-literal.nix b/nixd/tools/nixd-lint/test/url-literal.nix new file mode 100644 index 000000000..cbd648c45 --- /dev/null +++ b/nixd/tools/nixd-lint/test/url-literal.nix @@ -0,0 +1,5 @@ +# RUN: nixd-lint %s | FileCheck %s +{ + # CHECK: warning: URL literal is deprecated + bar = http://1.1.1.1; +}