-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Closed
Copy link
Description
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Elixir 1.18.0 (compiled with Erlang/OTP 25)
Operating system
Pop!_OS 22.04 LTS
Current behavior
Consider the following:
defmodule A do
def fun1() do
&fun2().fun1/0
end
def fun2() do
__MODULE__
end
endWhen I compile this with Elixir 1.18.0 I see this warning:
warning: expected a map or struct when accessing .fun1 in expression:
fun2().fun1
but got type:
dynamic(A)
hint: "var.field" (without parentheses) means "var" is a map() while "var.fun()" (with parentheses) means "var" is an atom()
typing violation found at:
│
3 │ &fun2().fun1/0
│ ~
│
└─ (capture_type_warning 0.1.0) lib/capture_type_warning.ex:3:13: A.fun1/0
A simpler version without the indirection of fun2() does not produce this warning:
defmodule A do
def fun1() do
&__MODULE__.fun1/0
end
endExpected behavior
I'm not sure to be honest. I don't think this would emit a type warning at all?
Metadata
Metadata
Assignees
Labels
No labels