From 7526c0db2e3d9b082c0cf3cf449ac9740673833f Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Tue, 2 Apr 2024 16:54:20 +0200 Subject: [PATCH] Add clarifying docstring to TypeContext compatibility check --- src/pystencils/backend/kernelcreation/typification.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pystencils/backend/kernelcreation/typification.py b/src/pystencils/backend/kernelcreation/typification.py index ec615d8f4..190cd9e23 100644 --- a/src/pystencils/backend/kernelcreation/typification.py +++ b/src/pystencils/backend/kernelcreation/typification.py @@ -184,6 +184,11 @@ class TypeContext: expr.dtype = self._target_type def _compatible(self, dtype: PsType): + """Checks whether the given data type is compatible with the context's target type. + + If the target type is ``const``, they must be equal up to const qualification; + if the target type is not ``const``, `dtype` must match it exactly. + """ assert self._target_type is not None if self._target_type.const: return constify(dtype) == self._target_type -- GitLab