Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub exports and decompiled source exports don't match for Elixir.Bitwise.beam #575

Closed
KronicDeth opened this issue Jan 2, 2017 · 1 comment · Fixed by #579
Closed
Assignees
Labels
Milestone

Comments

@KronicDeth
Copy link
Owner

KronicDeth commented Jan 2, 2017

The decompiled Elixir.Bitwise.beam:

# Source code recreated from a .beam file by IntelliJ Elixir
defmodule Bitwise do
  defmacro &&&(p0, p1, p2) do
    # body not decompiled
  end

  defmacro <<<(p0, p1, p2) do
    # body not decompiled
  end

  defmacro >>>(p0, p1, p2) do
    # body not decompiled
  end

  defmacro ^^^(p0, p1, p2) do
    # body not decompiled
  end

  defmacro __using__(p0, p1) do
    # body not decompiled
  end

  defmacro band(p0, p1, p2) do
    # body not decompiled
  end

  defmacro bnot(p0, p1) do
    # body not decompiled
  end

  defmacro bor(p0, p1, p2) do
    # body not decompiled
  end

  defmacro bsl(p0, p1, p2) do
    # body not decompiled
  end

  defmacro bsr(p0, p1, p2) do
    # body not decompiled
  end

  defmacro bxor(p0, p1, p2) do
    # body not decompiled
  end

  defmacro |||(p0, p1, p2) do
    # body not decompiled
  end

  defmacro ~~~(p0, p1) do
    # body not decompiled
  end

  def __info__(p0) do
    # body not decompiled
  end

  def module_info() do
    # body not decompiled
  end

  def module_info(p0) do
    # body not decompiled
  end
end

has 16 CallDefinitionImpl according to ModuleImpl#exports(), but only 11 Call according to ModuleIMpl#exports(TreeElement). The decompiled source has 16 defs, so ModuleImpl#exports(TreeElement) has the error.

@KronicDeth KronicDeth added this to the 4.8.0 milestone Jan 2, 2017
@KronicDeth KronicDeth self-assigned this Jan 2, 2017
@KronicDeth
Copy link
Owner Author

It looks like symbolic names aren't being returned:

Expected :[&&&, <<<, >>>, ^^^, __using__, band, bnot, bor, bsl, bsr, bxor, |||, ~~~, __info__, module_info, module_info]
Actual   :[__using__, band, bnot, bor, bsl, bsr, bxor, ~~~, __info__, module_info, module_info]

KronicDeth added a commit that referenced this issue Jan 4, 2017
KronicDeth added a commit that referenced this issue Jan 4, 2017
Erlang version of Elixir macros have +1 arity because the Erlang
function takes the Caller as the first argument before taking the
arguments in the defmacro call.  This means when generating the
decompiled file -1 needs to be subjected from the arity.  Additionally,
with the correct arity, it is more obvious that some of the functions
names for #575 were invalid because they were operators, so for
operators place them infix in the defmacro call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant