diff --git a/toolchain/mfc/params/registry.py b/toolchain/mfc/params/registry.py index 2d79f00157..1d93eae624 100644 --- a/toolchain/mfc/params/registry.py +++ b/toolchain/mfc/params/registry.py @@ -233,7 +233,11 @@ def register(self, param: ParamDef) -> None: if param.name in self._params: existing = self._params[param.name] if existing.param_type != param.param_type: - raise ValueError(f"Type mismatch for '{param.name}'") + raise ValueError( + f"Type mismatch for '{param.name}': " + f"existing type is {existing.param_type!r}, " + f"new type is {param.param_type!r}" + ) existing.tags.update(param.tags) for tag in param.tags: self._by_tag[tag].add(param.name) diff --git a/toolchain/mfc/params_tests/test_registry.py b/toolchain/mfc/params_tests/test_registry.py index 2f36ca78a3..56d453f335 100644 --- a/toolchain/mfc/params_tests/test_registry.py +++ b/toolchain/mfc/params_tests/test_registry.py @@ -38,7 +38,8 @@ def test_register_type_mismatch_raises(self): with self.assertRaises(ValueError) as ctx: reg.register(ParamDef(name="test", param_type=ParamType.REAL)) - self.assertIn("Type mismatch", str(ctx.exception)) + self.assertIn("existing type is", str(ctx.exception)) + self.assertIn("new type is", str(ctx.exception)) def test_get_params_by_tag(self): """get_params_by_tag should return params with that tag."""