Skip to main content

W0085: Unavailable Function

Error

-module(main).
main() ->
app_c:exists().
%%^^^^^^^^^^^^^^ warning: W0085: The function 'app_c:exists/0' is defined in application 'app_c', but the application is not a dependency of 'app_a' (defined in 'cell//app_a:lib').

Explanation

This diagnostic warns you when your code calls a function which does exist, but which lives in an application that your application does not declare as a dependency.

It is the function-level counterpart of W0059, which performs the same check for types.

Relation to W0017

W0017 asks "does M:F/A exist anywhere in the project?". This diagnostic asks the narrower question "does M:F/A exist in a declared dependency of the calling application?". A call can satisfy W0017 and still be reported here: the code compiles in a whole-project build, but the calling application would not link against the target application on its own.

What This Diagnostic Checks

An application is considered reachable when it is the caller's own application, an OTP application, or reachable through the caller's declared dependencies. Calls that cannot be resolved statically (dynamic module expressions) and calls that do not resolve to any function are left to W0017.

The dependency relation is derived from the build system, and is currently only available for Buck projects. For other project models the diagnostic does not fire.

How to Fix

  • Add the application that defines the function to your application's dependencies
  • Or move the code so that the call originates from an application that already declares the dependency