-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Don't crash when inspecting OTP 29 native records #15278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -669,6 +669,11 @@ defimpl Inspect, for: Any do | |
| Inspect.Map.inspect_as_struct(struct, Macro.inspect_atom(:literal, module), info, opts) | ||
| end | ||
|
|
||
| # A temporary clause to deal with native records until they are officially supported | ||
| def inspect(native_record, _opts) do | ||
|
josevalim marked this conversation as resolved.
|
||
| :io_lib.format("~p", [native_record]) |> IO.iodata_to_binary() | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is obviously very naive implementation just to prevent crashes, a more robust one would use https://github.com/erlang/otp/blob/OTP-29.0-rc3/lib/stdlib/src/io_lib.erl#L727:L750 |
||
| end | ||
|
|
||
| def inspect_as_struct(map, name, infos, opts) do | ||
| open = color_doc("#" <> name <> "<", :map, opts) | ||
| sep = color_doc(",", :map, opts) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add a comment that this is only temporary code, that we'll need to revisit if we add proper support for native record?