Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conformance tests: mark pytype as failing generics_scope #1704

Merged
merged 1 commit into from
Apr 9, 2024
Merged
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
3 changes: 1 addition & 2 deletions conformance/results/pyre/generics_scoping.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ conformance_automated = "Fail"
errors_diff = """
Line 65: Expected 1 errors
Line 75: Expected 1 errors
Line 74: Unexpected errors ['generics_scoping.py:74:0 Uninitialized attribute [13]: Attribute `attr` is declared in class `Outer` to have type `Outer.Inner[Variable[T]]` but is never initialized.']
Line 77: Unexpected errors ['generics_scoping.py:77:4 Uninitialized attribute [13]: Attribute `x` is declared in class `Outer.AlsoBad` to have type `typing.List[Variable[T]]` but is never initialized.']
"""
ignore_errors = ["Uninitialized attribute [13]"]
13 changes: 5 additions & 8 deletions conformance/results/pytype/generics_scoping.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
conformant = "Pass"
conformant = "Partial"
notes = """
Fails to reject type alias within generic class that uses class's type variable.
Fails to reject unbound type variable in constructor call in global scope.
"""
output = """
File "generics_scoping.py", line 29, in <module>: Function MyClass.meth_2 was called with the wrong arguments [wrong-arg-types]
File "generics_scoping.py", line 39, in method: bad return type [bad-return-type]
Called from (traceback):
line 43, in current file
File "generics_scoping.py", line 39, in method: bad return type [bad-return-type]
Called from (traceback):
line 42, in current file
File "generics_scoping.py", line 50, in fun_3: Invalid type annotation 'List[S]' for z [invalid-annotation]
File "generics_scoping.py", line 54, in Bar: Invalid type annotation 'List[S]' for an_attr [invalid-annotation]
File "generics_scoping.py", line 63, in fun_4: Invalid type annotation 'T' [invalid-annotation]
Expand All @@ -21,7 +19,6 @@ Line 65: Expected 1 errors
Line 75: Expected 1 errors
Line 84: Expected 1 errors
Line 90: Expected 1 errors
Line 39: Unexpected errors ['File "generics_scoping.py", line 39, in method: bad return type [bad-return-type]', 'File "generics_scoping.py", line 39, in method: bad return type [bad-return-type]']
Line 63: Unexpected errors ['File "generics_scoping.py", line 63, in fun_4: Invalid type annotation \\'T\\' [invalid-annotation]']
Line 74: Unexpected errors ['File "generics_scoping.py", line 74, in <module>: Invalid type annotation \\'Outer\\' [invalid-annotation]']
"""
4 changes: 2 additions & 2 deletions conformance/tests/generics_scoping.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def meth_2(self, x: T) -> T: # and here are always the same

class Foo(Generic[T]):
def method(self, x: T, y: S) -> S:
...
return y

x: Foo[int] = Foo()
assert_type(x.method(0, "abc"), str)
Expand All @@ -54,7 +54,7 @@ class Bar(Generic[T]):
an_attr: list[S] = [] # E

def do_something(self, x: S) -> S: # OK
...
return x

# A generic class definition that appears inside a generic function
# should not use type variables that parameterize the generic function.
Expand Down