8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
TBD
Sorry, something went wrong.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right, though somehow it never made a difference in my tests. The value C (the class) is not the same sort of thing as an instance of the class C.
C
Do you plan to add support for invoking a class method on a value of type Type[C]?
Type[C]
Of course; I hope that already works.
--Guido (mobile) On May 25, 2016 10:03 AM, "Reid Barton" notifications@github.com wrote:
Do you plan to add support for invoking a class method on a value of type Type[C]? — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub #1569 (comment)
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub #1569 (comment)
76273b5
52bb2a6
Tentative tests for Type[C].
b7ddf36
Pave the way for implementing Type[C].
eb61f1d
WIP: Introducing TypeType: Type[x] becomes TypeType(x).
7b52ac6
WIP: Fix/new tests; implement more subtype checks.
1fd14f0
WIP: Towards supporting Type[T].
371e425
The TypeC tests no pass except for one ProUser* that should be ProUser; but something's seriously wrong because many other tests now fail.
Fix things so all tests pass!
96696ff
Some cleanup and fixup (not done).
aa37595
- Add tests for Type[Any] and plain Type, and fix a bug that found. - Respond to easy review feedback (adding comments/docstrings mostly).
Improve equivalence between type and Type.
d4745b0
Add support for method lookup from Type[].
cf4a0b7
We only support two special cases (hopefully the most common ones): - Type[<concrete_class>] - Type[<type_variable_with_concrete_class_upper_bound>]
Print a proper error for unsupported Type[] args.
81ee239
(This happens when type checking a call, not during semantic analysis.)
cd2f20c
90b7824
Make Type[A] erase to Type[A], but Type[T] erases to Type[Any].
db30d59
Special-case joining Type[] with builtins.type.
6029c9d
Also add tests.
786ef96
Delete outdated XXX comment.
ef247f2
Finishing touch -- fix and test TypeAnalyser.visit_type_type().
4162103
Another look? I've addressed all XXX comments, and added more tests. Would like to get this in 0.4.2.
Ignore AppVeyor. I don't know why it keeps doing this even though I removed appveyor.yml.
Test calling with invalid arguments to __init__. Also test a class with non-default __init__ and call constructor with both valid and invalid arguments.
__init__
Please ignore the AppVeyor build, as usual.
Added tests as requested.
26ff267
Remove comment asking for name for analyze_type_type_callee().
256b31a
Addressed all remaining comments.
Don't return AnyType here -- instead, use self.default(self.s), which usually returns object.
AnyType
self.default(self.s)
object
Use self.default(self.s) instead of AnyType()/NonType() in join/meet.
d224aff
Looks pretty good now! Here are a few additional things to test:
Type[Any]
[ta, tc]
ta
Type[A]
tb
Type[B]
B
A
These are optional but if you don't implement these consider creating issues:
Callable[..]
Callable
TypeType
Add tests for overloaded __init__.
d9c74a0
Add more tests. Fixed a bug in join() this found.
eaa9e0d
Pushed solutions for the first 4 bullets.
Looks like Type[C] is indeed a subtype of Callable[[], C]:
class C: pass T = Type[C] def f(a: Callable[[], C]) -> None: pass f(C) f(T)
has no errors. I can write a more elaborate test after lunch.
UPDATE: But I'm not sure what the last two bullets imply then. UPDATE2: Filed #1670 for that, left this PR unchanged.
8555adb
Allow calling Type[T] where T has generic bound (#5309)
573be3e
Fix #3631 : looks like it was an explicit decision, made before we had self types. The code modified in this PR was introduced at #1569. There are no tests for the current behavior, and it seems like we actually want to allow it.
Successfully merging this pull request may close these issues.