From 7b37f1c0e01f07191ba268005948653a0b3af7a6 Mon Sep 17 00:00:00 2001 From: Till Ehrengruber Date: Sun, 1 Dec 2024 20:55:42 +0100 Subject: [PATCH] Fix type synthesizer for partially typed arithmetic ops --- src/gt4py/next/iterator/type_system/type_synthesizer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gt4py/next/iterator/type_system/type_synthesizer.py b/src/gt4py/next/iterator/type_system/type_synthesizer.py index 5be9ed7438..5fc78a7c6f 100644 --- a/src/gt4py/next/iterator/type_system/type_synthesizer.py +++ b/src/gt4py/next/iterator/type_system/type_synthesizer.py @@ -94,6 +94,10 @@ def power(base: ts.ScalarType, exponent: ts.ScalarType) -> ts.ScalarType: @_register_builtin_type_synthesizer(fun_names=itir.BINARY_MATH_NUMBER_BUILTINS) def _(lhs: ts.ScalarType, rhs: ts.ScalarType) -> ts.ScalarType: + if isinstance(lhs, ts.DeferredType): + return rhs + if isinstance(rhs, ts.DeferredType): + return lhs assert lhs == rhs return lhs