Skip to content

Conversation

@sabiwara
Copy link
Contributor

@sabiwara sabiwara commented Jan 14, 2026

#14837, same as 7c13e99.

URIs can also be inlined and cause similar issues that can't be fixed by generated anymore (same with a module attr containing a URI).

Example repro:

  @spec inlined :: URI.t()
  def inlined, do: URI.new!("example.com")
lib/repro.ex:27:contract_with_opaque
The @spec for Example.inlined/0 has an opaque
subtype %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()
} which is violated by the success typing.

Success typing:
() :: %URI{
  :authority => nil,
  :fragment => nil,
  :host => nil,
  :path => <<_::88>>,
  :port => nil,
  :query => nil,
  :scheme => nil,
  :userinfo => nil
}

Not sure if we're still backporting, but if yes I think this probably should be?

Co-authored-by: José Valim <jose.valim@gmail.com>
@sabiwara sabiwara merged commit 3b75c46 into elixir-lang:main Jan 14, 2026
11 checks passed
@sabiwara sabiwara deleted the opaque-authority branch January 14, 2026 15:29

# We don't use opaque because URIs can be inlined,
# either via module attributes or by the compiler.
@doc deprecated: "The authority field is deprecated"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sabiwara was the switch from typedoc to doc intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all, thanks for the catch @novaugust ! 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants