@@ -54,21 +54,19 @@ defmodule Module.Types.PatternTest do
5454 test "errors on conflicting refinements" do
5555 assert typeerror! ( [ a = b , a = :foo , b = :bar ] , { a , b } ) ==
5656 ~l"""
57- the following pattern will never match :
57+ incompatible types assigned to "a" :
5858
59- a = b
59+ dynamic(:foo) !~ dynamic(:bar)
6060
61- where "a" was given the type :
61+ where "a" was given the types :
6262
6363 # type: dynamic(:foo)
64- # from: types_test.ex:LINE-1
64+ # from: types_test.ex:55
6565 a = :foo
6666
67- where "b" was given the type:
68-
6967 # type: dynamic(:bar)
70- # from: types_test.ex:LINE-1
71- b = :bar
68+ # from: types_test.ex:55
69+ a = b
7270 """
7371 end
7472
@@ -120,17 +118,31 @@ defmodule Module.Types.PatternTest do
120118 assert typeerror! ( [ x = { :ok , _ } = { :error , _ , _ } ] , x ) == ~l"""
121119 the following pattern will never match:
122120
123- [_ | _] = x
121+ x = {:ok, _} = {:error, _, _}
122+ """
124123
125- because the right-hand side has type:
124+ assert typeerror! ( [ x = { :ok , y } = { :error , z , w } ] , { x , y , z , w } ) == ~l"""
125+ incompatible types assigned to "x":
126126
127- dynamic({:ok, term()} )
127+ dynamic() !~ none( )
128128
129129 where "x" was given the type:
130130
131- # type: dynamic({:ok, term()})
132- # from: types_test.ex:LINE
133- x = {:ok, _}
131+ # type: none()
132+ # from: types_test.ex:124
133+ x = {:ok, y} = {:error, z, w}
134+ """
135+
136+ assert typeerror! ( [ { :ok , y } = { :error , z , w } ] , { y , z , w } ) == ~l"""
137+ incompatible types assigned to "match" (context Module.Types.Pattern):
138+
139+ dynamic() !~ none()
140+
141+ where "match" (context Module.Types.Pattern) was given the type:
142+
143+ # type: none()
144+ # from: types_test.ex:136
145+ {:ok, y} = {:error, z, w}
134146 """
135147
136148 assert typeerror! ( [ x = { :ok , _ } ] , [ _ | _ ] = x ) == ~l"""
0 commit comments