Skip to content

Breaking change: module.__info__(:struct) #14616

Closed
@hissssst

Description

@hissssst

Elixir and Erlang/OTP versions

Difference between 1.17 and 1.18

Operating system

any

Current behavior

Erlang/OTP 27 [erts-15.2.7] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.17.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> defmodule X do
...(1)>   defstruct [:x]
...(1)> end
...
iex(2)> X.__info__ :struct
[%{field: :x, required: false}]
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.18.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> defmodule X do
...(1)>   defstruct [:x]
...(1)> end
iex(2)> X.__info__ :struct
[%{default: nil, field: :x}]

Same code returns different results. Changelog says nothing about it.

I know about Macro.struct_info!, but it is present only in 1.18 and now I need to add compile-time conditions in the library of mine to support these different behaviours

Expected behavior

Compatibility


e3bad83
This commit introduced the issue

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