We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fecce0d commit f79d833Copy full SHA for f79d833
conformance/tests/specialtypes_optional_nested.py
@@ -0,0 +1,16 @@
1
+"""
2
+Tests for behavior of nested Optional types collapsing.
3
+
4
+Optional[Optional[T]] should behave as Optional[T].
5
6
7
+from typing import Optional, assert_type
8
9
10
+def test_nested_optional(x: Optional[Optional[int]]) -> None:
11
+ # Should behave like Optional[int]
12
+ assert_type(x, Optional[int])
13
14
15
+def test_nested_optional_error(x: Optional[Optional[int]]) -> int:
16
+ return x # E
0 commit comments