Skip to content

Module definitions lost after defoverridable #8896

@mguimas

Description

@mguimas

Environment

$ elixir --version
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.8.1 (compiled with Erlang/OTP 21)

Current behavior

Given a file defining this module

defmodule MyOtherModule do
  def foo, do: "hello"
  IO.inspect Module.definitions_in(__MODULE__, :def), label: "Definitions 1"
  defoverridable [foo: 0]
  IO.inspect Module.definitions_in(__MODULE__, :def), label: "Definitions 2"
end

when compiled gives the following output:

$ mix do clean, compile
Compiling 18 files (.ex)
Definitions 1: [foo: 0]
Definitions 2: []
Generated things app

That is, the module definitions have been lost after the defoverridable clause.

Expected behavior

Declaring something as overridable should not affect the fact that it is a declared definition, consequently the output should be

$ mix do clean, compile
Compiling 18 files (.ex)
Definitions 1: [foo: 0]
Definitions 2: [foo: 0]
Generated things app

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