Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions conformance/results/mypy/constructors_callable.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Line 107: Unexpected errors ['constructors_callable.py:107: error: Expression is
Line 118: Unexpected errors ['constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]']
Line 128: Unexpected errors ['constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]', 'constructors_callable.py:128: error: Too few arguments [call-arg]']
Line 145: Unexpected errors ['constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [assert-type]', 'constructors_callable.py:145: error: Too few arguments [call-arg]']
Line 187: Unexpected errors ['constructors_callable.py:187: error: Expression is of type "Class8[Any]", not "Class8[int | str]" [assert-type]', 'constructors_callable.py:187: error: Cannot infer function type argument [misc]']
Line 199: Unexpected errors ['constructors_callable.py:199: error: Cannot infer function type argument [misc]']
Line 215: Unexpected errors ['constructors_callable.py:215: error: Expression is of type "Class10[Any]", not "Class10[int]" [assert-type]', 'constructors_callable.py:215: error: Cannot infer function type argument [misc]']
Line 229: Unexpected errors ['constructors_callable.py:229: error: Cannot infer function type argument [misc]']
"""
output = """
constructors_callable.py:36: note: Revealed type is "def (x: int) -> constructors_callable.Class1"
Expand Down Expand Up @@ -43,7 +47,19 @@ constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any
constructors_callable.py:145: error: Too few arguments [call-arg]
constructors_callable.py:164: note: Revealed type is "Overload(def (x: int) -> constructors_callable.Class7[int], def (x: str) -> constructors_callable.Class7[str])"
constructors_callable.py:184: note: Revealed type is "def [T] (x: list[T], y: list[T]) -> constructors_callable.Class8[T]"
constructors_callable.py:186: error: Cannot infer function type argument [misc]
constructors_callable.py:195: note: Revealed type is "def [T] (x: list[T], y: list[T]) -> constructors_callable.Class9"
constructors_callable.py:197: error: Cannot infer function type argument [misc]
constructors_callable.py:185: error: Argument 2 has incompatible type "str"; expected "list[str]" [arg-type]
constructors_callable.py:187: error: Expression is of type "Class8[Any]", not "Class8[int | str]" [assert-type]
constructors_callable.py:187: error: Cannot infer function type argument [misc]
constructors_callable.py:196: note: Revealed type is "def [T] (x: list[T], y: list[T]) -> constructors_callable.Class9"
constructors_callable.py:197: error: Argument 2 has incompatible type "str"; expected "list[str]" [arg-type]
constructors_callable.py:199: error: Cannot infer function type argument [misc]
constructors_callable.py:210: note: Revealed type is "def [T_int <: int] (x: list[T_int], y: list[T_int]) -> constructors_callable.Class10[T_int]"
constructors_callable.py:211: error: Argument 2 has incompatible type "str"; expected "list[int]" [arg-type]
constructors_callable.py:212: error: Cannot infer function type argument [misc]
constructors_callable.py:215: error: Expression is of type "Class10[Any]", not "Class10[int]" [assert-type]
constructors_callable.py:215: error: Cannot infer function type argument [misc]
constructors_callable.py:224: note: Revealed type is "def [T_int <: int] (x: list[T_int], y: list[T_int]) -> constructors_callable.Class11"
constructors_callable.py:225: error: Argument 2 has incompatible type "str"; expected "list[int]" [arg-type]
constructors_callable.py:226: error: Cannot infer function type argument [misc]
constructors_callable.py:229: error: Cannot infer function type argument [misc]
"""
23 changes: 19 additions & 4 deletions conformance/results/pycroscope/constructors_callable.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
conformance_automated = "Pass"
conformant = "Partial"
notes = """
List literal arguments are inferred in isolation before specialization inference
"""
conformance_automated = "Fail"
errors_diff = """
Line 187: Unexpected errors ['./constructors_callable.py:187:12: ./constructors_callable.py.Class8[Any[error]] is not equivalent to ./constructors_callable.py.Class8[int | str]', './constructors_callable.py:187:12: Cannot resolve type variables [incompatible_call]']
Line 199: Unexpected errors ['./constructors_callable.py:199:12: Cannot resolve type variables [incompatible_call]']
"""
output = """
./constructors_callable.py:36:12: Revealed type is '(x: int) -> ./constructors_callable.py.Class1' [reveal_type]
Expand All @@ -21,7 +27,16 @@ output = """
./constructors_callable.py:146:0: Takes 0 positional arguments but 1 were given [incompatible_call]
./constructors_callable.py:164:4: Revealed type is '(x: ~_Ctor_Class7_T) -> ./constructors_callable.py.Class7[~_Ctor_Class7_T]' [reveal_type]
./constructors_callable.py:184:12: Revealed type is '(x: list[~T@./constructors_callable.py.Class8], y: list[~T@./constructors_callable.py.Class8]) -> ./constructors_callable.py.Class8[~T@./constructors_callable.py.Class8]' [reveal_type]
./constructors_callable.py:186:0: Cannot resolve type variables [incompatible_call]
./constructors_callable.py:195:12: Revealed type is '(x: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__], y: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__]) -> ./constructors_callable.py.Class9' [reveal_type]
./constructors_callable.py:197:0: Cannot resolve type variables [incompatible_call]
./constructors_callable.py:185:9: Incompatible argument type for y: expected list[~T@./constructors_callable.py.Class8] but got Literal['not a list'] [incompatible_argument]
./constructors_callable.py:187:12: ./constructors_callable.py.Class8[Any[error]] is not equivalent to ./constructors_callable.py.Class8[int | str]
./constructors_callable.py:187:12: Cannot resolve type variables [incompatible_call]
./constructors_callable.py:196:12: Revealed type is '(x: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__], y: list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__]) -> ./constructors_callable.py.Class9' [reveal_type]
./constructors_callable.py:197:9: Incompatible argument type for y: expected list[~T@./constructors_callable.py.Class9.__init__.<locals>.__init__] but got Literal['not a list'] [incompatible_argument]
./constructors_callable.py:199:12: Cannot resolve type variables [incompatible_call]
./constructors_callable.py:210:12: Revealed type is '(x: list[~T_int@./constructors_callable.py.Class10], y: list[~T_int@./constructors_callable.py.Class10]) -> ./constructors_callable.py.Class10[~T_int@./constructors_callable.py.Class10]' [reveal_type]
./constructors_callable.py:211:9: Incompatible argument type for y: expected list[~T_int@./constructors_callable.py.Class10] but got Literal['not a list'] [incompatible_argument]
./constructors_callable.py:212:9: Incompatible argument type for y: expected list[~T_int@./constructors_callable.py.Class10] but got Literal[['']] [incompatible_argument]
./constructors_callable.py:224:12: Revealed type is '(x: list[~T_int@./constructors_callable.py.Class11.__init__.<locals>.__init__], y: list[~T_int@./constructors_callable.py.Class11.__init__.<locals>.__init__]) -> ./constructors_callable.py.Class11' [reveal_type]
./constructors_callable.py:225:9: Incompatible argument type for y: expected list[~T_int@./constructors_callable.py.Class11.__init__.<locals>.__init__] but got Literal['not a list'] [incompatible_argument]
./constructors_callable.py:226:9: Incompatible argument type for y: expected list[~T_int@./constructors_callable.py.Class11.__init__.<locals>.__init__] but got Literal[['']] [incompatible_argument]
"""
23 changes: 19 additions & 4 deletions conformance/results/pyrefly/constructors_callable.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ Converting constructor to callable does not preserve class-scoped type params.
"""
conformance_automated = "Fail"
errors_diff = """
Line 186: Expected 1 errors
Line 185: Unexpected errors ['assert_type(Class8[Unknown], Class8[str]) failed [assert-type]']
Line 212: Expected 1 errors
Line 186: Unexpected errors ['assert_type(Class8[Unknown], Class8[str]) failed [assert-type]']
Line 187: Unexpected errors ['assert_type(Class8[Unknown], Class8[int | str]) failed [assert-type]']
Line 199: Unexpected errors ['Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]']
Line 213: Unexpected errors ['assert_type(Class10[Unknown], Class10[int]) failed [assert-type]']
Line 214: Unexpected errors ['assert_type(Class10[Unknown], Class10[bool]) failed [assert-type]']
Line 215: Unexpected errors ['assert_type(Class10[Unknown], Class10[int]) failed [assert-type]']
"""
output = """
ERROR constructors_callable.py:38:3-5: Missing argument `x` [missing-argument]
Expand All @@ -21,6 +26,16 @@ ERROR constructors_callable.py:82:3-8: Missing argument `x` [missing-argument]
ERROR constructors_callable.py:82:4-5: Unexpected keyword argument `y` [unexpected-keyword]
ERROR constructors_callable.py:129:4-5: Expected 0 positional arguments, got 1 [bad-argument-count]
ERROR constructors_callable.py:146:8-9: Expected 0 positional arguments, got 1 [bad-argument-count]
ERROR constructors_callable.py:185:12-41: assert_type(Class8[Unknown], Class8[str]) failed [assert-type]
ERROR constructors_callable.py:197:9-13: Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
ERROR constructors_callable.py:185:10-22: Argument `Literal['not a list']` is not assignable to parameter `y` with type `list[Unknown]` [bad-argument-type]
ERROR constructors_callable.py:186:12-41: assert_type(Class8[Unknown], Class8[str]) failed [assert-type]
ERROR constructors_callable.py:187:12-46: assert_type(Class8[Unknown], Class8[int | str]) failed [assert-type]
ERROR constructors_callable.py:197:10-22: Argument `Literal['not a list']` is not assignable to parameter `y` with type `list[str]` [bad-argument-type]
ERROR constructors_callable.py:199:21-25: Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
ERROR constructors_callable.py:211:10-22: Argument `Literal['not a list']` is not assignable to parameter `y` with type `list[Unknown]` [bad-argument-type]
ERROR constructors_callable.py:213:12-41: assert_type(Class10[Unknown], Class10[int]) failed [assert-type]
ERROR constructors_callable.py:214:12-48: assert_type(Class10[Unknown], Class10[bool]) failed [assert-type]
ERROR constructors_callable.py:215:12-44: assert_type(Class10[Unknown], Class10[int]) failed [assert-type]
ERROR constructors_callable.py:225:10-22: Argument `Literal['not a list']` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
ERROR constructors_callable.py:226:4-15: `str` is not assignable to upper bound `int` of type variable `T_int` [bad-specialization]
ERROR constructors_callable.py:226:10-14: Argument `list[str]` is not assignable to parameter `y` with type `list[int]` [bad-argument-type]
"""
30 changes: 25 additions & 5 deletions conformance/results/pyright/constructors_callable.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
conformant = "Pass"
conformance_automated = "Pass"
conformant = "Partial"
notes = """
List literal arguments are inferred in isolation before specialization inference
"""
conformance_automated = "Fail"
errors_diff = """
Line 187: Unexpected errors ['constructors_callable.py:187:13 - error: "assert_type" mismatch: expected "Class8[int | str]" but received "Class8[int]" (reportAssertTypeFailure)', 'constructors_callable.py:187:22 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@Class8]"']
Line 199: Unexpected errors ['constructors_callable.py:199:22 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]"']
"""
output = """
constructors_callable.py:36:13 - information: Type of "r1" is "(x: int) -> Class1"
Expand All @@ -25,9 +30,24 @@ constructors_callable.py:144:13 - information: Type of "r6_any" is "() -> Any"
constructors_callable.py:146:8 - error: Expected 0 positional arguments (reportCallIssue)
constructors_callable.py:164:5 - information: Type of "r7" is "Overload[(x: int) -> Class7[int], (x: str) -> Class7[str]]"
constructors_callable.py:184:13 - information: Type of "r8" is "(x: list[T@Class8], y: list[T@Class8]) -> Class8[T@Class8]"
constructors_callable.py:186:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@Class8]"
constructors_callable.py:185:10 - error: Argument of type "Literal['not a list']" cannot be assigned to parameter "y" of type "list[T@Class8]"
  "Literal['not a list']" is not assignable to "list[str]" (reportArgumentType)
constructors_callable.py:187:13 - error: "assert_type" mismatch: expected "Class8[int | str]" but received "Class8[int]" (reportAssertTypeFailure)
constructors_callable.py:187:22 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@Class8]"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_callable.py:196:13 - information: Type of "r9" is "(x: list[T@__init__], y: list[T@__init__]) -> Class9"
constructors_callable.py:197:10 - error: Argument of type "Literal['not a list']" cannot be assigned to parameter "y" of type "list[T@__init__]"
  "Literal['not a list']" is not assignable to "list[str]" (reportArgumentType)
constructors_callable.py:199:22 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_callable.py:210:13 - information: Type of "r10" is "(x: list[T_int@Class10], y: list[T_int@Class10]) -> Class10[T_int@Class10]"
constructors_callable.py:211:10 - error: Argument of type "Literal['not a list']" cannot be assigned to parameter "y" of type "list[T_int@Class10]"
  "Literal['not a list']" is not assignable to "list[int]" (reportArgumentType)
constructors_callable.py:212:11 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T_int@Class10]"
  "Literal['']" is not assignable to "int" (reportArgumentType)
constructors_callable.py:195:13 - information: Type of "r9" is "(x: list[T@__init__], y: list[T@__init__]) -> Class9"
constructors_callable.py:197:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]"
constructors_callable.py:224:13 - information: Type of "r11" is "(x: list[T_int@__init__], y: list[T_int@__init__]) -> Class11"
constructors_callable.py:225:10 - error: Argument of type "Literal['not a list']" cannot be assigned to parameter "y" of type "list[T_int@__init__]"
  "Literal['not a list']" is not assignable to "list[int]" (reportArgumentType)
constructors_callable.py:226:11 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T_int@__init__]"
  "Literal['']" is not assignable to "int" (reportArgumentType)
"""
8 changes: 4 additions & 4 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ <h3>Python Type System Conformance Test Results</h3>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructors_callable</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not generate a union type for __new__ and __init__ when converting class to callable.</p><p>Does not ignore __init__ based on __new__ return type when converting class to callable.</p><p>Does not support __new__ return type that is different from class being constructed.</p></span></div></th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>List literal arguments are inferred in isolation before specialization inference</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>List literal arguments are inferred in isolation before specialization inference</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Converting constructor to callable does not preserve class-scoped type params.</p></span></div></th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not include `__init__` when `__new__` returns `Self`.</p><p>Does not respect `NoReturn` return type on metaclass `__call__`.</p><p>Does not ignore `__init__` when `__new__` returns `Any`.</p><p>Unions overload return types.</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>List literal arguments are inferred in isolation before specialization inference</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not include `__init__` when `__new__` returns `Self`.</p><p>Does not respect `NoReturn` return type on metaclass `__call__`.</p><p>Does not ignore `__init__` when `__new__` returns `Any`.</p><p>Unions overload return types.</p><p>List literal arguments are inferred in isolation before specialization inference</p></span></div></th>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructors_consistency</th>
<th class="column col2 conformant"><div class="hover-text">Pass*<span class="tooltip-text" id="bottom"><p>Does not report inconsistency between __new__ and __init__ (optional).</p></span></div></th>
Expand Down
Loading