We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05b650f commit 0328d86Copy full SHA for 0328d86
lib/elixir/lib/kernel.ex
@@ -3247,14 +3247,9 @@ defmodule Kernel do
3247
true ->
3248
fields =
3249
try do
3250
- module = caller.module
3251
-
3252
- # We are using the access protocol in the same
3253
- # module that defines it. It works, but we need
3254
- # to read the field values from @record_fields.
3255
- case atom do
3256
- ^module -> Module.get_attribute(module, :record_fields)
3257
- _ -> atom.__record__(:fields)
+ case Module.open?(atom) do
+ true -> Module.get_attribute(atom, :record_fields)
+ false -> atom.__record__(:fields)
3258
end
3259
rescue
3260
UndefinedFunctionError ->
0 commit comments