-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix some daemon crashes involving classes becoming generic #8157
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d84fc52
Fix some daemon crashes involving classes becoming generic
msullivan 9f0d800
do join
msullivan ab19890
actually fix
msullivan 6d369b5
remove a check
msullivan 272f53c
kick, since travis has forgotten me????
msullivan a39a249
some more testing
msullivan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9288,3 +9288,92 @@ class B: | |
self.x = 0 | ||
[out] | ||
== | ||
|
||
[case testGenericChange1] | ||
import a | ||
[file a.py] | ||
import b | ||
def f() -> b.C: pass | ||
[file b.py] | ||
import a | ||
class C: pass | ||
[file b.py.2] | ||
from typing import TypeVar, Generic, List | ||
import a | ||
|
||
T = TypeVar('T') | ||
class C(Generic[T]): pass | ||
|
||
reveal_type(a.f) | ||
c: C[int] | ||
l = a.f() if True else c | ||
d = a.f() | ||
d = c | ||
c = d | ||
|
||
x: List[C] = [a.f(), a.f()] | ||
|
||
[out] | ||
== | ||
b.py:7: note: Revealed type is 'def () -> b.C[Any]' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about a similar test case where a class goes from generic to non-generic? |
||
[builtins fixtures/list.pyi] | ||
|
||
[case testGenericChange2] | ||
import a | ||
[file a.py] | ||
import b | ||
def f() -> b.C[int]: pass | ||
[file b.py] | ||
from typing import TypeVar, Generic | ||
import a | ||
T = TypeVar('T') | ||
class C(Generic[T]): pass | ||
[file b.py.2] | ||
from typing import List | ||
import a | ||
|
||
class C(): pass | ||
|
||
c: C | ||
l = a.f() if True else c | ||
d = a.f() | ||
d = c | ||
c = d | ||
|
||
x: List[C] = [a.f(), a.f()] | ||
|
||
[builtins fixtures/list.pyi] | ||
[out] | ||
== | ||
a.py:2: error: "C" expects no type arguments, but 1 given | ||
|
||
[case testGenericChange3] | ||
import a | ||
[file a.py] | ||
import b | ||
def f() -> b.C[int]: pass | ||
[file b.py] | ||
from typing import TypeVar, Generic | ||
import a | ||
T = TypeVar('T') | ||
class C(Generic[T]): pass | ||
[file b.py.2] | ||
from typing import TypeVar, Generic, List | ||
import a | ||
|
||
T = TypeVar('T') | ||
S = TypeVar('S') | ||
class C(Generic[S, T]): pass | ||
|
||
c: C[int, str] | ||
l = a.f() if True else c | ||
d = a.f() | ||
d = c | ||
c = d | ||
|
||
x: List[C] = [a.f(), a.f()] | ||
|
||
[out] | ||
== | ||
a.py:2: error: "C" expects 2 type arguments, but 1 given | ||
[builtins fixtures/list.pyi] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kind of unfortunate that we have to do this. Another option might be to make
args
a property and have it adjust the number of args dynamically if theTypeInfo
has changed. This could have performance impliciations, however.