File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
lib/elixir/test/elixir/module/types Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1052,13 +1052,25 @@ defmodule Module.Types.ExprTest do
10521052 end
10531053
10541054 describe "conditionals" do
1055- test "if does not report on literal booleans " do
1055+ test "if does not report on literal atoms " do
10561056 assert typecheck! (
10571057 if true do
10581058 :ok
10591059 end
10601060 ) == atom ( [ :ok , nil ] )
10611061 end
1062+
1063+ test "and does not report on literal atoms" do
1064+ assert typecheck! ( false and true ) == boolean ( )
1065+ end
1066+
1067+ test "and reports on non-atom literals" do
1068+ assert typeerror! ( 1 and true ) == ~l"""
1069+ the following conditional expression will always evaluate to integer():
1070+
1071+ 1
1072+ """
1073+ end
10621074 end
10631075
10641076 describe "receive" do
You can’t perform that action at this time.
0 commit comments