Skip to content

Conversation

TylerPachal
Copy link
Contributor

@TylerPachal TylerPachal commented Sep 20, 2024

Calling a function without the parenthesis () is a compiler warning in newer versions of Elixir.

This is the stacktrace I am seeing in my project:

warning: using map.field notation (without parentheses) to invoke function MyProjWeb.MyView.type() is deprecated, you must add parentheses instead: remote.function()
  (jsonapi 1.8.1) lib/jsonapi/plugs/query_parser.ex:299: JSONAPI.QueryParser.field_valid_for_relationship?/2
  (elixir 1.17.3) lib/enum.ex:4315: Enum.find_list/3
  (jsonapi 1.8.1) lib/jsonapi/plugs/query_parser.ex:288: JSONAPI.QueryParser.get_view_for_type/2
  (jsonapi 1.8.1) lib/jsonapi/plugs/query_parser.ex:282: JSONAPI.QueryParser.get_valid_fields_for_type/2
  (jsonapi 1.8.1) lib/jsonapi/plugs/query_parser.ex:140: anonymous fn/3 in JSONAPI.QueryParser.parse_fields/2
  (stdlib 4.3.1.4) maps.erl:411: :maps.fold_1/3
  (jsonapi 1.8.1) lib/jsonapi/plugs/query_parser.ex:102: JSONAPI.QueryParser.call/2
  (myproj 0.1.0) lib/signal_web/controllersmy_controller.ex:1: MyProjWeb.MyController.phoenix_controller_pipeline/2
  (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
  (signal 0.1.0) lib/signal_web/endpoint.ex:1: SignalWeb.Endpoint.plug_builder_call/2
  (signal 0.1.0) lib/signal_web/endpoint.ex:1: SignalWeb.Endpoint."call (overridable 3)"/2
  (signal 0.1.0) lib/signal_web/endpoint.ex:1: SignalWeb.Endpoint.call/2
  (phoenix 1.7.14) lib/phoenix/test/conn_test.ex:225: Phoenix.ConnTest.dispatch/5
  (ex_unit 1.17.3) lib/ex_unit/runner.ex:485: ExUnit.Runner.exec_test/2
  (ex_unit 1.17.3) lib/ex_unit/capture_log.ex:113: ExUnit.CaptureLog.with_log/2
  (ex_unit 1.17.3) lib/ex_unit/runner.ex:434: anonymous fn/3 in ExUnit.Runner.maybe_capture_log/3

This PR fixes the calls to zero-arity functions and fixes the compiler warnings 👍

@TylerPachal TylerPachal requested a review from a team as a code owner September 20, 2024 15:19
@TylerPachal TylerPachal changed the title Fix compiler warnings Chore: Fix compiler warnings Sep 20, 2024
@TylerPachal TylerPachal changed the title Chore: Fix compiler warnings Fix: Compiler warnings for zero-arity funtion calls Sep 20, 2024
@TylerPachal TylerPachal changed the title Fix: Compiler warnings for zero-arity funtion calls fix: Compiler warnings for zero-arity funtion calls Sep 20, 2024
@TylerPachal
Copy link
Contributor Author

I am not sure what the problem is with the Dialyzer and Credo checks. No deps were changed in this PR.

@mattpolzin
Copy link
Member

This should be fixed hopefully if you rebase or merge with main: #336

@TylerPachal
Copy link
Contributor Author

Thanks @mattpolzin, everything is passing now 👍

@mattpolzin mattpolzin merged commit 49ed6ab into beam-community:main Sep 22, 2024
8 checks passed
@TylerPachal TylerPachal deleted the fix-compiler-warnings branch September 23, 2024 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants