Elixir v1.18.0-rc.0 released

Was gonna say, this is was giving me any type vibes only right in code. Feels like it should be a special form that somehow only works in ExUnit. Or perhaps be called Kernel.return_dynamic_value_but_only_use_this_function_in_tests_ok? :upside_down_face:

2 Likes

I think its closer to unknown than any, which has significantly less ugliness, but ultimately IMO you canโ€™t have a gradually typed language w/ type inference and not give people an option along these lines.

More succinctly, if the function is called Kernel.return_dynamic_value_but_only_use_this_function_in_tests_ok? then people will just use Process.get :laughing:

I definitely think care should be taken with the naming, documentation and functionality of the function, but I donโ€™t think its realistic to do anything other than give it a name that represents what it does from a type system perspective, and then discourage people from using it.

2 Likes

I agree

1 Like

Haha yes, I was mostly joking.

1 Like

This is working perfectly, thank you :heart:

Was the :warnings_as_errors flag under elixirc_options or test_elixirc_options also deprecated? I now see a warning when using this option with test_elixirc_options:

warning: :warnings_as_errors is deprecated as part of Code.get_compiler_option/1
  (elixir 1.18.0-rc.0) lib/code.ex:1597: Code.get_compiler_option/1
  (elixir 1.18.0-rc.0) lib/code.ex:1572: anonymous fn/2 in Code.compiler_options/1
  (elixir 1.18.0-rc.0) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
  (elixir 1.18.0-rc.0) lib/code.ex:1571: Code.compiler_options/1
  (mix 1.18.0-rc.0) lib/mix/compilers/test.ex:28: Mix.Compilers.Test.require_and_run/4
  (mix 1.18.0-rc.0) lib/mix/tasks/test.ex:617: Mix.Tasks.Test.do_run/3

That should not have warned. I will investigate.

EDIT: Yes, I have double checked and it is deprecated indeed as it is not a compiler option. I have updated the CHANGELOG and improved the deprecation message.

2 Likes