Skip to content

Commit bc7f06a

Browse files
committed
New union
1 parent 7cb3db7 commit bc7f06a

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

typesafety/test_typeclass/test__call__.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
some(B()) # ok
129129
some(C()) # ok
130130
out: |
131-
main:22: error: Argument 1 to "some" has incompatible type "A"; expected "Union[B, C]"
131+
main:22: error: Argument 1 to "some" has incompatible type "A"; expected "B"
132132
133133
134134
- case: typeclass_call_variance_union2

typesafety/test_typeclass/test_callback.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
4040
accepts_typeclass(example)
4141
out: |
42-
main:16: error: Argument 1 to "accepts_typeclass" has incompatible type "_TypeClass[Union[int, float], Callable[[Any, bool], bool], <nothing>, Literal['main.example']]"; expected "Callable[[str, bool], bool]"
43-
main:16: note: "_TypeClass[Union[int, float], Callable[[Any, bool], bool], <nothing>, Literal['main.example']].__call__" has type "Callable[[Arg(Union[float, Supports[<nothing>]], 'instance'), VarArg(Any), KwArg(Any)], _ReturnType]"
42+
main:16: error: Argument 1 to "accepts_typeclass" has incompatible type "_TypeClass[float, Callable[[Any, bool], bool], <nothing>, Literal['main.example']]"; expected "Callable[[str, bool], bool]"
43+
main:16: note: "_TypeClass[float, Callable[[Any, bool], bool], <nothing>, Literal['main.example']].__call__" has type "Callable[[Arg(Union[float, Supports[<nothing>]], 'instance'), VarArg(Any), KwArg(Any)], _ReturnType]"

typesafety/test_typeclass/test_supports/test_typeguard.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
reveal_type(item)
5252
to_json(item) # ok
5353
out: |
54-
main:20: error: Argument 1 to "to_json" has incompatible type "Union[int, str]"; expected "Union[Dict[Any, Any], int, Supports[ToJson]]"
55-
main:23: note: Revealed type is "Union[builtins.dict[Any, Any], builtins.int]"
54+
main:20: error: Argument 1 to "to_json" has incompatible type "Union[int, str]"; expected "Union[int, Dict[Any, Any], Supports[ToJson]]"
55+
main:23: note: Revealed type is "Union[builtins.int, builtins.dict[Any, Any]]"
5656
5757
5858
- case: typeclass_function_supports_typeguard_generic1
@@ -82,8 +82,8 @@
8282
reveal_type(item)
8383
copy(item) # ok
8484
out: |
85-
main:19: error: Argument 1 to "copy" has incompatible type "Union[builtins.int, builtins.str]"; expected "Union[builtins.int, builtins.dict[Any, Any]]"
86-
main:22: note: Revealed type is "Union[builtins.int, builtins.dict[Any, Any]]"
85+
main:19: error: Argument 1 to "copy" has incompatible type "Union[builtins.int, builtins.str]"; expected "Union[builtins.dict[Any, Any], builtins.int]"
86+
main:22: note: Revealed type is "Union[builtins.dict[Any, Any], builtins.int]"
8787
8888
8989
- case: typeclass_object_supports_typeguard_generic1
@@ -116,5 +116,5 @@
116116
reveal_type(item)
117117
copy(item) # ok
118118
out: |
119-
main:22: error: Argument 1 to "copy" has incompatible type "Union[builtins.int, builtins.str]"; expected "Union[builtins.int, builtins.dict[Any, Any], classes._typeclass.Supports[main.Copy]]"
120-
main:25: note: Revealed type is "Union[builtins.int, builtins.dict[Any, Any]]"
119+
main:22: error: Argument 1 to "copy" has incompatible type "Union[builtins.int, builtins.str]"; expected "Union[builtins.dict[Any, Any], builtins.int, classes._typeclass.Supports[main.Copy]]"
120+
main:25: note: Revealed type is "Union[builtins.dict[Any, Any], builtins.int]"

typesafety/test_typeclass/test_typeclass.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
to_json('a')
3333
to_json(None)
3434
out: |
35-
main:20: error: Argument 1 to "to_json" has incompatible type "None"; expected "Union[int, str, Supports[ToJson]]"
35+
main:20: error: Argument 1 to "to_json" has incompatible type "None"; expected "Union[str, int, Supports[ToJson]]"
3636
3737
3838
- case: typeclass_class_wrong_sig

0 commit comments

Comments
 (0)