Skip to content

Commit

Permalink
Added a cast to make mypy happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiker committed Aug 21, 2024
1 parent 282df65 commit e5dd7c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/fab/tools/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def compile_file(self, input_file: Path,
if add_flags is None:
add_flags = []
if self._compiler.category is Category.FORTRAN_COMPILER:
# Mypy complains that self._compiler does not take the syntax
# only parameter. Since we know it's a FortranCompiler.
# do a cast to tell mypy that this is now a Fortran compiler
# (or a CompilerWrapper in case of nested CompilerWrappers,
# which also supports the syntax_only flag anyway)
self._compiler = cast(FortranCompiler, self._compiler)
self._compiler.compile_file(input_file, output_file, openmp=openmp,
add_flags=self.flags + add_flags,
syntax_only=syntax_only,
Expand Down

0 comments on commit e5dd7c9

Please sign in to comment.