Skip to content
Snippets Groups Projects

Fix handling of constness in Typifier

Merged Frederik Hennig requested to merge fhennig/fix-const-typing into backend-rework
All threads resolved!
Compare and Show latest version
1 file
+ 5
0
Preferences
Compare changes
@@ -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