From 3d54fd67d244028ffb32d4ca622ecf7850d11282 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 bf5a17ce4..0fde0431e 100644 --- a/nixd/lib/Syntax/Parser/Parser.y +++ b/nixd/lib/Syntax/Parser/Parser.y @@ -416,6 +416,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; +}