zeam-vm / pelemay_backend

PelemayBackend: A memory-saving, fault-tolerant and distributed collection of Nx compilers and backends for embedded systems.
Apache License 2.0
25 stars 0 forks source link

Fail to dialyzer #62

Closed zacky1972 closed 1 year ago

zacky1972 commented 1 year ago

In benchmarks/onnx_to_axon_bench

% mix dialyzer                         
Compiling 1 file (.ex)
Finding suitable PLTs
Checking PLT...
[:asn1, :axon, :axon_onnx, :benchee, :castore, :compiler, :complex, :crypto, :decimal, :deep_merge, :elixir, :exla, :finch, :flow, :gen_stage, :hpax, :jason, :kernel, :logger, :mime, :mint, :mix, :nimble_options, :nimble_pool, :nx, :progress_bar, :protox, :public_key, :req, :ssl, :statistex, :stdlib, :telemetry]
PLT is up to date!
No :ignore_warnings opt specified in mix.exs and default does not exist.

Starting Dialyzer
[
  check_plt: false,
  init_plt: '/Users/zacky/github/pelemay_backend/benchmarks/onnx_to_axon_bench/_build/dev/dialyxir_erlang-26.0_elixir-1.14.4_deps-dev.plt',
  files: ['/Users/zacky/github/pelemay_backend/benchmarks/onnx_to_axon_bench/_build/dev/lib/onnx_to_axon_bench/ebin/Elixir.OnnxToAxonBench.beam'],
  warnings: [:unknown]
]
Total errors: 2, Skipped: 0, Unnecessary Skips: 0
done in 0m1.44s
lib/onnx_to_axon_bench.ex:144:no_return
The created anonymous function has no local return.
________________________________________________________________________________
lib/onnx_to_axon_bench.ex:147:no_return
The created anonymous function has no local return.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
% mix dialyzer.explain unmatched_return
The invoked expression returns a union of types and the call does
not match on its return types using e.g. a case or wildcard.

## Example

    defmodule Example do
      require Integer

      def ok() do
        n = :rand.uniform(100)

        multiple_returns(n)

        :ok
      end

      defp multiple_returns(n) do
        if Integer.is_even(n) do
          :ok
        else
          {:error, "error"}
        end
      end
    end

  This would NOT result in a warning:

    defmodule Example do
      require Integer

      def ok() do
        n = :rand.uniform(100)

        multiple_returns(n)

        :ok
      end

      defp multiple_returns(n) do
        if Integer.is_even(n) do
          :ok
        else
          :error
        end
      end
    end
zacky1972 commented 1 year ago

Branch is issue/62.

remote: 
remote: Create a pull request for 'issue/62' on GitHub by visiting:
remote:      https://github.com/zeam-vm/pelemay_backend/pull/new/issue/62
remote: