Skip to content

Opaqueness warning on OTP28 #14750

@sabiwara

Description

@sabiwara

Elixir and Erlang/OTP versions

1.18.4 and v1.19 branches, OTP28

Operating system

Current behavior

  @base_uri URI.new!("https://example.com")
  def foo_uri do
    @base_uri |> URI.append_path("/foo")
  end
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>>
)

Expected behavior

No warning.

This is exactly like #14576 all over again, but for module attributes rather than inline calls 😭

We could:

  1. mark as generated after escaping (again, reducing the usefulness of the type system :/)
  2. remove opaqueness as previously suggested - this should eventually be checked via the new type system anyway?
  3. do nothing and require people to locally silent warning in such cases
  4. disable dialyzer opaqueness checks as previously mentioned - not sure at which level though?

Originally reported here

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