Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d126ce4
Add foundation for fine-grained incremental type checking
JukkaL Jan 20, 2017
c690fec
Attempt to fix tests on Windows
JukkaL Feb 9, 2017
38d69aa
Try to work around travis failure
JukkaL Feb 10, 2017
3b98a1d
Add missing import
JukkaL Mar 2, 2017
4f3b192
Another attempt to fix the travis build
JukkaL Mar 2, 2017
da6631c
Fix typos
JukkaL Mar 3, 2017
2799278
Support multiple rounds of event propagation
JukkaL Feb 9, 2017
28d8279
Keep track of targets that generated an error
JukkaL Feb 11, 2017
f38024b
Refactor and continue reporting error if no changes
JukkaL Mar 3, 2017
01ed71c
Fix bugs
JukkaL Mar 3, 2017
709740a
Create dependencies for inheritance
JukkaL Mar 7, 2017
3a67189
Detect differences in MRO
JukkaL Mar 7, 2017
42a77b6
Merge base classes and MRO
JukkaL Mar 7, 2017
093d17d
Add support for minimal debug output
JukkaL Mar 7, 2017
5a6eb05
Add test cases
JukkaL Mar 7, 2017
2763794
Fix to attributes, inheritance and fine-grained incremenal
JukkaL Mar 7, 2017
d9cfc3f
Fix handling changes to attributes in base classes
JukkaL Mar 8, 2017
07bc54b
Fixes to dependency generation
JukkaL Mar 8, 2017
d95864b
Support classes as fine-grained incremental targets
JukkaL Mar 8, 2017
baeb421
Fix inheritance test case
JukkaL Mar 8, 2017
41c81aa
Add minimal package support
JukkaL Mar 8, 2017
82afe22
Add tests for __init__ modules
JukkaL Mar 8, 2017
e5199da
Add test cases for module attributes
JukkaL Mar 8, 2017
84b7a62
Fix test case
JukkaL Mar 9, 2017
67a54d7
Implement multiple propagation steps for module attributes
JukkaL Mar 9, 2017
54c800d
Support constructors for fine-grained incremental
JukkaL Mar 9, 2017
770cc61
Support from m import with fine-grained incremental
JukkaL Mar 9, 2017
2f0c0a7
Support nested classes with fine-grained incremental
JukkaL Mar 10, 2017
b480807
Fix merge test case
JukkaL Mar 10, 2017
0636545
Remove debug print
JukkaL Mar 10, 2017
e271844
More nested class test cases
JukkaL Mar 10, 2017
291286f
Fixes to classes with fine-grained incremental
JukkaL Mar 10, 2017
25a2846
Minor fixes
JukkaL Mar 21, 2017
2b9104c
Add review feedback
JukkaL Mar 28, 2017
ef97a75
Address more feedback and fix a bug
JukkaL Mar 29, 2017
23ca75b
Add additional debug output
JukkaL Mar 30, 2017
027f79b
Fix issues caused by rebase
JukkaL Apr 3, 2017
dbd5d67
Remove travis CI workaround
JukkaL Apr 3, 2017
a47ecb8
Fix another issue caused by the rebase
JukkaL Apr 3, 2017
ba17fe4
Fix flaky test case
JukkaL Apr 3, 2017
d3bf923
Fix flaky test by making processing order deterministic
JukkaL Apr 3, 2017
5c03d7e
Attempt to fix tests on Windows
JukkaL Apr 4, 2017
89adec4
Fix deferred lambdas
JukkaL Apr 5, 2017
287f831
Fix self check failure
JukkaL Apr 5, 2017
43d16e4
Merge branch 'master' into fine-grained
JukkaL Apr 5, 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
Add review feedback
  • Loading branch information
JukkaL committed Apr 3, 2017
commit 2b9104c52a029425eb084562386387950f0d33ca
12 changes: 7 additions & 5 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def check_second_pass(self, todo: List[DeferredNode] = None) -> bool:
self.pass_num += 1
if not todo:
todo = self.deferred_nodes
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what if todo and self.deferred_nodes are both non-empty?

else:
assert not self.deferred_nodes
self.deferred_nodes = []
done = set() # type: Set[Union[FuncDef, MypyFile]]
for node, type_name, active_typeinfo in todo:
Expand Down Expand Up @@ -234,7 +236,7 @@ def check_top_level(self, node: MypyFile) -> None:

def handle_cannot_determine_type(self, name: str, context: Context) -> None:
node = self.scope.top_function()
if self.pass_num < LAST_PASS and node is not None:
if self.pass_num < LAST_PASS and node is not None and isinstance(node, FuncDef):
# Don't report an error yet. Just defer.
if self.errors.type_name:
type_name = self.errors.type_name[-1]
Expand Down Expand Up @@ -651,7 +653,7 @@ def is_implicit_any(t: Type) -> bool:
for i in range(len(typ.arg_types)):
arg_type = typ.arg_types[i]

ref_type = self.scope.active_self_type() # type: Type
ref_type = self.scope.active_self_type() # type: Optional[Type]
if (isinstance(defn, FuncDef) and ref_type is not None and i == 0
and not defn.is_static
and typ.arg_kinds[0] not in [nodes.ARG_STAR, nodes.ARG_STAR2]):
Expand Down Expand Up @@ -3012,12 +3014,12 @@ def is_node_static(node: Node) -> Optional[bool]:

class Scope:
# We keep two stacks combined, to maintain the relative order
stack = None # type: List[Union[TypeInfo, FuncDef, MypyFile]]
stack = None # type: List[Union[TypeInfo, FuncItem, MypyFile]]

def __init__(self, module: MypyFile) -> None:
self.stack = [module]

def top_function(self) -> Optional[FuncDef]:
def top_function(self) -> Optional[FuncItem]:
for e in reversed(self.stack):
if isinstance(e, FuncItem):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FuncDef

return e
Expand All @@ -3035,7 +3037,7 @@ def active_self_type(self) -> Optional[Union[Instance, TupleType]]:
return None

@contextmanager
def push_function(self, item: FuncDef) -> Iterator[None]:
def push_function(self, item: FuncItem) -> Iterator[None]:
self.stack.append(item)
yield
self.stack.pop()
Expand Down
1 change: 1 addition & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def refresh_class_def(self, defn: ClassDef) -> None:
with self.analyze_class_body(defn) as should_continue:
if should_continue:
for d in defn.defs.body:
# TODO: Make sure refreshing class bodies works.
if isinstance(d, ClassDef):
self.refresh_class_def(d)
elif not isinstance(d, FuncItem):
Expand Down