Huh. I think you may have found a bug. Here’s an IEx session from 1.15.7:
Erlang/OTP 25 [erts-13.2.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.15.7) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> import_file "repr.exs"
{:module, Reproduce,
<<70, 79, 82, 49, 0, 0, 5, 196, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 200,
0, 0, 0, 19, 16, 69, 108, 105, 120, 105, 114, 46, 82, 101, 112, 114, 111,
100, 117, 99, 101, 8, 95, 95, 105, 110, 102, ...>>, {:run, 0}}
iex(2)> Reproduce.run()
** (EXIT from #PID<0.106.0>) shell process exited with reason: shutdown: failed to start child: MyTask
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function MyTask.start_link/1 is undefined or private
MyTask.start_link([])
(stdlib 4.3.1.3) supervisor.erl:420: :supervisor.do_start_child_i/3
(stdlib 4.3.1.3) supervisor.erl:406: :supervisor.do_start_child/2
(stdlib 4.3.1.3) supervisor.erl:390: anonymous fn/3 in :supervisor.start_children/2
(stdlib 4.3.1.3) supervisor.erl:1256: :supervisor.children_map/4
(stdlib 4.3.1.3) supervisor.erl:350: :supervisor.init_children/2
(stdlib 4.3.1.3) gen_server.erl:851: :gen_server.init_it/2
(stdlib 4.3.1.3) gen_server.erl:814: :gen_server.init_it/6
Interactive Elixir (1.15.7) - press Ctrl+C to exit (type h() ENTER for help)
iex(2)>
But in 1.17.2:
Erlang/OTP 26 [erts-14.2.5.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Application.ensure_all_started(:sasl)
{:ok, [:sasl]}
iex(2)> import_file("repr.exs")
{:module, Reproduce,
<<70, 79, 82, 49, 0, 0, 5, 160, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 200,
0, 0, 0, 19, 16, 69, 108, 105, 120, 105, 114, 46, 82, 101, 112, 114, 111,
100, 117, 99, 101, 8, 95, 95, 105, 110, 102, ...>>, {:run, 0}}
iex(3)> Reproduce.run()
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(3)> require Logger
Logger
iex(4)> Logger.warning("test")
06:13:08.957 [warning] test
:ok
iex(5)> Reproduce.run()
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(5)>