Skip to content

Handle Erlang/OTP 28 nominal types in Code.Typespec.fetch_types/1#15562

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
lukaszsamson:ls-nominal-fetch-types
Jul 9, 2026
Merged

Handle Erlang/OTP 28 nominal types in Code.Typespec.fetch_types/1#15562
josevalim merged 1 commit into
elixir-lang:mainfrom
lukaszsamson:ls-nominal-fetch-types

Conversation

@lukaszsamson

Copy link
Copy Markdown
Contributor

Split out of #15559 as requested. -nominal type declarations (EEP 69, Erlang/OTP 28) are silently dropped by Code.Typespec.fetch_types/1. This returns them as {:nominal, type} entries, mirroring how :opaque is reported, with an OTP >= 28 gated regression test.

This is not hypothetical on OTP 28: for example :erl_anno declares line/0 and location/0 as nominal types, so any consumer expanding remote types through fetch_types/1 (such as Code.fetch_docs/1 spec tooling) currently cannot resolve them.

Assisted-By: Claude Fable 5

🤖 Generated with Claude Code

-nominal type declarations (EEP 69, OTP 28) were silently dropped from
the result. Return them as {:nominal, type} entries, mirroring how
:opaque is reported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@josevalim josevalim merged commit 77426cc into elixir-lang:main Jul 9, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@lukaszsamson

Copy link
Copy Markdown
Contributor Author

@josevalim Have you considered exposing @nominal and supporting it in typespec compiler?

@josevalim

Copy link
Copy Markdown
Member

@lukaszsamson yes but we typically only add such features once it is supported by all OTP versions supported by Elixir, otherwise it introduces a hidden version requirement.

lukaszsamson added a commit to lukaszsamson/elixir that referenced this pull request Jul 9, 2026
Two review findings:

- :spec_wider_return entries were auto-triaged but only counted in
  stats, contradicting the comment that says tightening candidates
  remain discoverable. The JSON output now carries them in a
  tightening_hints section with full entry detail (not gated).

- Prompt mode omitted untranslatable entries and still instructed
  reviewers to judge spec_wider_return, which no longer appears in its
  data. It now includes untranslatables and the instructions match the
  actual verdict set, including the dynamic_args probe.

Also drops the Code.fetch_docs/1 exclusion: :erl_anno's nominal types
resolve now that Code.Typespec.fetch_types/1 returns them (elixir-lang#15562),
and the tool reported the entry as stale -- zero untranslatable specs
remain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants