compilers: fix inconsistent None-breaking return value for compile()

Since commit abc7e6af01 it is not possible
for this set of methods to return None, which was an odd thing to return
to begin with. Cease to annotate it as such.
pull/12839/head
Eli Schwartz 1 year ago
parent dbfc9d0908
commit 6be1262cc9
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 6
      mesonbuild/compilers/compilers.py

@ -750,7 +750,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
def compile(self, code: 'mesonlib.FileOrString',
extra_args: T.Union[None, CompilerArgs, T.List[str]] = None,
*, mode: CompileCheckMode = CompileCheckMode.LINK, want_output: bool = False,
temp_dir: T.Optional[str] = None) -> T.Iterator[T.Optional[CompileResult]]:
temp_dir: T.Optional[str] = None) -> T.Iterator[CompileResult]:
# TODO: there isn't really any reason for this to be a contextmanager
if mode == CompileCheckMode.PREPROCESS:
@ -812,7 +812,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
def cached_compile(self, code: 'mesonlib.FileOrString', cdata: coredata.CoreData, *,
extra_args: T.Union[None, T.List[str], CompilerArgs] = None,
mode: CompileCheckMode = CompileCheckMode.LINK,
temp_dir: T.Optional[str] = None) -> T.Iterator[T.Optional[CompileResult]]:
temp_dir: T.Optional[str] = None) -> T.Iterator[CompileResult]:
# TODO: There's isn't really any reason for this to be a context manager
# Calculate the key
@ -1238,7 +1238,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
extra_args: T.Union[None, CompilerArgs, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]] = None,
dependencies: T.Optional[T.List['Dependency']] = None,
mode: CompileCheckMode = CompileCheckMode.COMPILE, want_output: bool = False,
disable_cache: bool = False) -> T.Iterator[T.Optional[CompileResult]]:
disable_cache: bool = False) -> T.Iterator[CompileResult]:
"""Helper for getting a cached value when possible.
This method isn't meant to be called externally, it's mean to be

Loading…
Cancel
Save