| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Can a maintainer look at this / comment? |
Sorry, something went wrong.
|
Few comments:
|
Sorry, something went wrong.
I'm also now getting fallback can't be filled out until semanal I guess due to skipping analysis with the new semantic analyzer. |
Sorry, something went wrong.
|
I'm going to close this because it is against the old semantic analyzer which is totally gone now. Feel free to redo this against the current code base and I'll review it. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #607 (which is incorrectly titled).
This adds TypeInfo.is_no_type_check, and enables TypeInfo.fallback_to_any for classes decorated with @no_type_check, which is checked in a couple of places to abort the type checker early and stub method types as Any.
I'm not sure confident about my use of decorator.name in ('no_type_check', 'typing.no_type_check' in semanal.py. I see RefName.fullname = 'typing.no_type_check' was used elsewhere but it wasn't a RefName in the AST during semanal and I didn't look too far into that.
This is my current test:
from typing import no_type_check, Any @no_type_check class TestClass: bar: {'x': 1} = 1 def meth1(): pass def meth2(a: {'x': 1}) -> {'x': 1}: def garbage_inner(a: {'x': 1}): pass def test(a: int): pass TestClass().test(1) TestClass().doesntexist() class Test(TestClass): def test2(self, a: int): pass t = Test() t.meth1() t.doesntexist2() t.test(1) t.test2(1) x: int = TestClass().barWith @no_type_check, mypy throws a Missing return statement for the nested garbage_inner definition, but suppresses the rest of the type errors for this class and subclass.
Without @no_type_check, we get this nice pile of errors:
TODO (I'd like advice from core contributors on these):