From f34d1744b61cb63853b68a177b31ba5db4524336 Mon Sep 17 00:00:00 2001 From: belltoy Date: Fri, 2 Aug 2024 10:01:09 +0800 Subject: [PATCH 1/3] Add OTP 25 support back --- Cargo.lock | 2 ++ erlang_service/src/elp_lint.erl | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a31d259e99..7f54730794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2175,6 +2175,8 @@ dependencies = [ [[package]] name = "tree-sitter-erlang" version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a192ccd449ddc472fbbf0ff4ed1ad8402410614674599acdcba456abb1178c68" dependencies = [ "cc", "tree-sitter", diff --git a/erlang_service/src/elp_lint.erl b/erlang_service/src/elp_lint.erl index 1ac386b7cd..9088895023 100644 --- a/erlang_service/src/elp_lint.erl +++ b/erlang_service/src/elp_lint.erl @@ -1419,7 +1419,7 @@ check_unused_records(Forms, St0) -> maps:remove(Used, Recs) end, St1#lint.records, UsedRecords), Unused = [{Name,Anno} || - Name := {Anno,_Fields} <- URecs, + {Name, {Anno,_Fields}} <- maps:to_list(URecs), element(1, loc(Anno, St1)) =:= FirstFile], foldl(fun ({N,Anno}, St) -> add_warning(Anno, {unused_record, N}, St) @@ -2217,8 +2217,8 @@ is_guard_test(Expression, Forms, IsOverridden) -> %% processing the forms until we'll know that the record %% definitions are truly needed. F = fun() -> - #{Name => {A,Fs} || - {attribute, A, record, {Name, Fs}} <- Forms} + Forms1 = [{Name, {A, Fs}} || {attribute, A, record, {Name, Fs}} <- Forms], + maps:from_list(Forms1) end, is_guard_test2(NoFileExpression, {F,IsOverridden}). @@ -3394,7 +3394,7 @@ check_unused_types_1(Forms, #lint{types=Ts}=St) -> reached_types(#lint{usage = Usage}) -> Es = [{From, {type, To}} || - To := UsedTs <- Usage#usage.used_types, + {To, UsedTs} <- maps:to_list(Usage#usage.used_types), #used_type{at = From} <- UsedTs], Initial = initially_reached_types(Es), G = sofs:family_to_digraph(sofs:rel2fam(sofs:relation(Es))), From f9b358e5dac33cdda27ec661e2266c12b8b5252f Mon Sep 17 00:00:00 2001 From: belltoy Date: Tue, 6 Aug 2024 10:40:59 +0800 Subject: [PATCH 2/3] Revert "CI: remove OTP 25 from the matrix (#38)" This reverts commit 6ecc191450c58cd50b824f1c2b40e516aa3f1f74. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23cb90adb8..6909bc9ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,11 @@ jobs: strategy: matrix: platform-arch: [ubuntu-20.04-x64, ubuntu-20.04-arm, macos-13-x64, macos-latest-arm] - otp-version: [ 26.2] + otp-version: [25.3, 26.2] include: + - otp-version: 25.3 + brew-otp-version: 25 + vscode-publish: true - otp-version: 26.2 brew-otp-version: 26 vscode-publish: true From dae23e29a934651d07b1d28dc670cce9039405be Mon Sep 17 00:00:00 2001 From: belltoy Date: Tue, 6 Aug 2024 22:22:48 +0800 Subject: [PATCH 3/3] Make vscode-publish for OTP 25 only --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6909bc9ad3..137fc8fada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: vscode-publish: true - otp-version: 26.2 brew-otp-version: 26 - vscode-publish: true + vscode-publish: false - platform-arch: ubuntu-20.04-x64 platform: ubuntu-20.04 os: linux