From 08797e13d9cdc5eaff3e16a816252e87eaa66057 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 4 Mar 2020 13:20:54 -0800 Subject: dependencies: Use CompilerType not Compiler Compiler is invariant, in other words Compiler and only Compiler can fulfull it, it's derived classes cannot be used. CompilerType is covariant, that is Compiler and any derived class can fulfill it. This fixes a number of issues in the boost module. --- mesonbuild/dependencies/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 6f8181d..5f212e6 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -38,7 +38,7 @@ from ..mesonlib import Popen_safe, version_compare_many, version_compare, listif from ..mesonlib import Version, LibType if T.TYPE_CHECKING: - from ..compilers.compilers import Compiler # noqa: F401 + from ..compilers.compilers import CompilerType # noqa: F401 DependencyType = T.TypeVar('DependencyType', bound='Dependency') # These must be defined in this file to avoid cyclical references. @@ -2488,7 +2488,7 @@ def factory_methods(methods: T.Set[DependencyMethods]) -> 'FactoryType': def detect_compiler(name: str, env: Environment, for_machine: MachineChoice, - language: T.Optional[str]) -> T.Optional['Compiler']: + language: T.Optional[str]) -> T.Optional['CompilerType']: """Given a language and environment find the compiler used.""" compilers = env.coredata.compilers[for_machine] -- cgit v1.1