Skip to content

Commit

Permalink
Restore OTP 25 support (#41)
Browse files Browse the repository at this point in the history
Summary:
I've read about the failure mentioned in #37. It's because the `erlang_service` uses the new map comprehension syntax introduced in OTP 26.

Only three places use the new syntax. Can we restore OTP 25 support by replacing the map comprehension with the legacy `maps:to_list`/`maps:from_list`?  I have built the `elp` based on `2024-07-16` and `2024-08-05`, seems to work fine.

Pull Request resolved: #41

Reviewed By: alanz

Differential Revision: D61018770

Pulled By: robertoaloi

fbshipit-source-id: 362e8417d6969aeea612c11ac88057d037ec3315
  • Loading branch information
belltoy authored and facebook-github-bot committed Aug 9, 2024
1 parent 2c30d29 commit 8b8eb2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ 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
vscode-publish: false
- platform-arch: ubuntu-20.04-x64
platform: ubuntu-20.04
os: linux
Expand Down
8 changes: 4 additions & 4 deletions erlang_service/src/elp_lint.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}).
Expand Down Expand Up @@ -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))),
Expand Down

0 comments on commit 8b8eb2e

Please sign in to comment.