Skip to content
Snippets Groups Projects
Commit 7526c0db authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Add clarifying docstring to TypeContext compatibility check

parent eb0ae32d
No related branches found
No related tags found
1 merge request!372Fix handling of constness in Typifier
Pipeline #64875 passed
...@@ -184,6 +184,11 @@ class TypeContext: ...@@ -184,6 +184,11 @@ class TypeContext:
expr.dtype = self._target_type expr.dtype = self._target_type
def _compatible(self, dtype: PsType): 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 assert self._target_type is not None
if self._target_type.const: if self._target_type.const:
return constify(dtype) == self._target_type return constify(dtype) == self._target_type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment