8000 Support for functions producing generic functions by sixolet · Pull Request #3113 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Support for functions producing generic functions #3113

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

Merged
merged 40 commits into from
Apr 21, 2017
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
679a172
Make it an error to use a class-attribute type var outside a type
sixolet Apr 1, 2017
74e9262
Fix the error message to handle more cases
sixolet Apr 1, 2017
5470c77
oops accidentally changed a file
sixolet Apr 1, 2017
12def8b
Typo fix
sixolet Apr 1, 2017
52782fe
more checking things in tests
sixolet Apr 1, 2017
0184595
Change error message
sixolet Apr 1, 2017
757a6b8
Change error message
sixolet Apr 1, 2017
57bca93
Make TypeQuery more general, handling nonboolean queries.
sixolet Mar 29, 2017
3b8bc23
Remove redundant empty check
sixolet Mar 29, 2017
82da335
Some types in the visitor were missing recursion
sixolet Mar 30, 2017
9f12644
Add ellipsis type handler to TypeQuery
sixolet Mar 30, 2017
8cf4fa6
Typechecks, but gives spurious error. Need to move variable binding?
sixolet Mar 30, 2017
2634277
Small change: Move tvar id generation nearer type analysis
sixolet Mar 30, 2017
30dba10
Even nearer
sixolet Mar 30, 2017
7b4f9f2
Replace the concept of BOUND_TVAR and UNBOUND_TVAR as mutative flags …
sixolet Mar 30, 2017
daf9592
Mid debugging gotta push now
sixolet Mar 30, 2017
826b9cf
Checkpoint. Most tests pass, classvar type aliases not yet
sixolet Mar 31, 2017
4141f94
forgot this file
sixolet Mar 31, 2017
58e3a2a
Fix aliasing to not bind type vars within a callable while aliasing
sixolet Mar 31, 2017
c061a09
removed some now-unused code
sixolet Apr 1, 2017
603013d
my own code review, first pass
sixolet Apr 1, 2017
c6fec63
Use type var query instead of another query fn
sixolet Apr 2, 2017
f46d52a
Tighten code
sixolet Apr 2, 2017
ea21337
fix some types
sixolet Apr 2, 2017
80d62a7
Use same type alias throughout
sixolet Apr 2, 2017
eaf8c0d
Make semanal tests pass. Delete one I think is wrong
sixolet Apr 2, 2017
5009a2b
Generator types for generators
sixolet Apr 2, 2017
7c64464
Lint and cleanups
sixolet Apr 3, 2017
a866d0f
Test for using generic function return as a decorator
sixolet Apr 11, 2017
9d5c630
Merge upstream
sixolet Apr 12, 2017
4683d70
Merge lint
sixolet Apr 12, 2017
cbb3cb0
Merged master; adapted code to use better TypeQuery
sixolet Apr 12, 2017
da0d936
More tests for nested and multi-type-var situations
sixolet Apr 12, 2017
edbecb0
Fixed type variable scoping rules to conform to PEP484 better
sixolet Apr 14, 2017
21d8b13
Move the typevars that are prohibited due to being bound by the class…
sixolet Apr 17, 2017
214aebc
More doc
sixolet Apr 17, 2017
5405646
Jukka comments
sixolet Apr 20, 2017
a25e926
one more
sixolet Apr 20, 2017
4aaab6c
get imports right
sixolet Apr 20, 2017
fd153ad
Merge branch 'master' into second-order-decorator
sixolet Apr 20, 2017
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
Prev Previous commit
Next Next commit
Even nearer
  • Loading branch information
sixolet committed Apr 2, 2017
commit 30dba10a61b577a156b218a87f6edfbceb3795d6
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,14 @@ def analyze_function(self, defn: FuncItem) -> None:

tvarnodes = []
if defn.type:
self.check_classvar_in_signature(defn.type)
assert isinstance(defn.type, CallableType)
tvarnodes = self.add_func_type_variables_to_symbol_table(defn.type, defn)
next_function_tvar_id = min([self.next_function_tvar_id()] +
[n.tvar_def.id.raw_id - 1 for n in tvarnodes])
self.next_function_tvar_id_stack.append(next_function_tvar_id)
# Signature must be analyzed in the surrounding scope so that
# class-level imported names and type variables are in scope.
self.check_classvar_in_signature(defn.type)
defn.type = self.anal_type(defn.type)
self.check_function_signature(defn)
if isinstance(defn, FuncDef):
Expand Down
0