KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.83k stars 153 forks source link

No decompiled source function with name (:inet_db.get_hosts_file) #2976

Closed samaddison closed 1 year ago

samaddison commented 1 year ago

System

Plugin Version: 14.0.0 Application: IntelliJ IDEA Ultimate Edition (2022.3.1) Operating System: Mac OS X (11.7.1)

What I was doing

Just adding a column to a table in a migration add :min_head_count, :integer

Event

Exception

Stacktrace

java.lang.Throwable: No decompiled source function with name (:inet_db.get_hosts_file) ``` java.lang.Throwable: No decompiled source function with name (:inet_db.get_hosts_file) at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202) at org.elixir_lang.beam.psi.impl.ModuleImpl.setMirror(ModuleImpl.kt:103) at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirror(ModuleElementImpl.java:55) at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:46) at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:37) at org.elixir_lang.beam.psi.BeamFileImpl.setMirror(BeamFileImpl.kt:409) at org.elixir_lang.beam.psi.BeamFileImpl.getMirror$lambda$6$lambda$5(BeamFileImpl.kt:389) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:224) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:664) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:620) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:232) at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:99) at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:232) at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:223) at org.elixir_lang.beam.psi.BeamFileImpl.getMirror(BeamFileImpl.kt:388) at org.elixir_lang.beam.psi.impl.ModuleElementImpl.getMirror(ModuleElementImpl.java:115) at org.elixir_lang.beam.psi.impl.ModuleImpl.getNavigationElement(ModuleImpl.kt:147) at org.elixir_lang.psi.scope.atom.Variants.projectLookupElementStream(Variants.java:49) at org.elixir_lang.psi.scope.atom.Variants.lookupElementList(Variants.java:24) at org.elixir_lang.reference.Atom.getVariants(Atom.java:25) ```
KronicDeth commented 1 year ago

This line in Erlang uses a variable called And

https://github.com/erlang/otp/blob/b52652deb54b247ab924b2f0fb12cf4286af6d7d/lib/kernel/src/inet_db.erl#L1854

eq_domains([A | As], [B | Bs]) ->
    if
        is_integer(A), 0 =< A, A =< 16#10FFFF,
        is_integer(B), 0 =< B, B =< 16#10FFFF ->
            %% An upper bound of 255 would be right right now,
            %% but this algorithm works for any integer.  That
            %% guard just gives the compiler the opportuinity
            %% to optimize bit operations for machine word size,
            %% so we might as well use the Unicode upper bound instead.
            Xor = (A bxor B),
            if
                Xor =:= 0 ->
                    eq_domains(As, Bs);
                Xor =:= ($A bxor $a) ->
                    And = (A band B),
                    if
                        ($A band $a) =< And, And =< ($Z band $z) ->
                            eq_domains(As, Bs);
                        true ->
                            false
                    end;
                true ->
                    false
            end
    end;

The decompiler treats the And like a non-keyword and so makes the Elixir variable and

  def eq_domains([a | as], [b | bs]) do
    cond do
      is_integer(a) and 0 <= a and a <= 1114111 and is_integer(b) and 0 <= b and b <= 1114111 ->
        xor = a ^^^ b
        cond do
          xor === 0 ->
            eq_domains(as, bs)
          xor === ?A ^^^ ?a ->
            and = a &&& b
            cond do
              ?A &&& ?a <= and and and <= ?Z &&& ?z ->
                eq_domains(as, bs)
              true ->
                false
            end
          true ->
            false
        end
    end
  end