hez

hez

"Function call without opaqueness type mismatch" under OTP 28

With this code under OTP 27 dialyzer ran cleanly:

defmodule Test do
  @base_uribase_uri URI.new!(“`https://google.ca`”)

  def our_base do
    @base_uri |> URI.append_path(“/foo”)
  end
end

But in OTP 28 we are getting the following error:


> mix dialyzer
…

---

lib/app/test.ex:5:call_without_opaque
Function call without opaqueness type mismatch.

Call does not have expected term of type %URI{
:authority => URI.authority(),
:fragment => nil | binary(),
:host => nil | binary(),
:path => nil | binary(),
:port => nil | char(),
:query => nil | binary(),
:scheme => nil | binary(),
:userinfo => nil | binary()
} (with opaque subterms) in the 1st position.

URI.append_path(
%URI{
:authority => nil,
:fragment => nil,
:host => <<103, 111, 111, 103, 108, 101, 46, 99, 97>>,
:path => nil,
:port => 443,
:query => nil,
:scheme => <<104, 116, 116, 112, 115>>,
:userinfo => nil
},
<<47, 102, 111, 111>>
)

First Post! Switch mode

LostKobrakai

LostKobrakai

This looks like something to report to the elixir repo.

Most Liked

sabiwara

sabiwara

Elixir Core Team

Thanks for sharing @grossvogel. This issue is un-killable :zombie:

You’re not doing anything wrong. But unfortunately I fear we’re getting out of options here to deal with it in the language itself.

I managed to silence it using the following two workarounds:

def produce do
 # option 1: un-inline the MapSet creation so it's not a literal anymore
 list = [1, 2, 3])
 MapSet.new(list)
end

or

# option 2: replace produce/0 by a module attr
@produce MapSet.new([1, 2, 3])
def driver, do: consume(@produce)

But honestly it might be better to just explicitly disable opaqueness checks when working with MapSet rather than jumping through hoops and try to trick dialyzer.

sabiwara

sabiwara

Elixir Core Team

OK I tried it out and it seems the error is still present on the v1.19 branch :cry:

Will open an issue.

Edit: issue link: Opaqueness warning on OTP28 · Issue #14750 · elixir-lang/elixir · GitHub

Last Post!

sabiwara

sabiwara

Elixir Core Team

Good question. I used to be optimistic as well but years later I think the only way to do it would be to vendor the implementation of :sets but just replace the signatures to not have opaque. Not a very enticing option either.

Because even after we removed the opaque from our own types and signatures, we’re still getting errors reported because dialyzer knows that the internals are calling :sets and the opaqueness propagates

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement