Skip to content

Commit

Permalink
Add a unit test for an edge case in paramSpec
Browse files Browse the repository at this point in the history
Summary:
The program specificed in the unittest is accepted by Pyright, but it is unspecified weather this is actually legal.

I am adding a unittest for it so we can decide how to handle it later.

Reviewed By: rchen152

Differential Revision: D63472244

fbshipit-source-id: 0abc405d450809fd910bfb807601d620726b648e
  • Loading branch information
Zeina Migeed authored and facebook-github-bot committed Sep 27, 2024
1 parent 1ed8557 commit 89f1a4d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source/analysis/test/integration/typeVariableTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ let test_type_variable_scoping =

|}
[];
(* TODO migeedz: Consider what we want to do about this. The conformance test says that we
should not return any errors, but Pyre does not accept such programs in legacy syntax
currently. *)
labeled_test_case __FUNCTION__ __LINE__
@@ assert_type_errors
{|
from typing import Callable

def decorator2[**P, R](x: int) -> Callable[[Callable[P, R]], Callable[P, R]]:
...

|}
[
"Invalid type [31]: Expression `typing.Callable[([typing.Callable[(P, R)]], \
typing.Callable[(P, R)])]` is not a valid type.";
];
(* PEP695 generic methods from non-generic classes *)
labeled_test_case __FUNCTION__ __LINE__
@@ assert_type_errors
Expand Down

0 comments on commit 89f1a4d

Please sign in to comment.