Skip to content

Compilation doesn't fail for warning: function/x is undefined(module is not available or is yet to be defined) with --warnings-as-errors as enabled #11648

@bagarey

Description

@bagarey

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:48:48] [ds:48:48:10] [async-threads:1]
Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
  • Operating system: Red Hat Enterprise Linux 7.5

Current behavior

  • An umbrella application with app common and sim are created and compiled successfully
  • Add calling of Sim.hello in Common.hello function
  • Compiling from umbrella root
$ mix compile --warnings-as-errors
==> common
Compiling 1 file (.ex)
warning: Sim.hello/0 is undefined (module Sim is not available or is yet to be defined)
  lib/common.ex:17: Common.hello/0

Generated common app
==> sim
Compiling 1 file (.ex)
Generated sim app

$ echo $?
0

Compiling the app in standalone doesn't fail either

[common]$ mix compile --warnings-as-errors
Compiling 1 file (.ex)
warning: Sim.hello/0 is undefined (module Sim is not available or is yet to be defined)
  lib/common.ex:17: Common.hello/0

Generated common app

[common]$ echo $?
0

Expected behavior

The compiler should've failed similar to when an unused function is used.

$ mix compile --warnings-as-errors
==> common
Compiling 1 file (.ex)
warning: function foo/0 is unused
  lib/common.ex:20

warning: Sim.hello/0 is undefined (module Sim is not available or is yet to be defined)
  lib/common.ex:17: Common.hello/0

Compilation failed due to warnings while using the --warnings-as-errors option

$ echo $?
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions