gemini-code-assist[bot] commented on code in PR #38548:
URL: https://github.com/apache/beam/pull/38548#discussion_r3269412605
##########
sdks/python/apache_beam/typehints/opcodes.py:
##########
@@ -447,6 +448,11 @@ def _getattr(o, name):
return Const(BoundMethod(func, o))
elif isinstance(o, row_type.RowTypeConstraint):
return o.get_type_for(name)
+ elif inspect.isclass(o) and dataclasses.is_dataclass(o):
Review Comment:

The `inspect.isclass(o)` check is unnecessarily restrictive.
`dataclasses.is_dataclass(o)` returns `True` for both dataclass classes and
instances. Removing the class check allows the type inference engine to
correctly resolve fields when it encounters a dataclass instance (for example,
when an instance is wrapped in a `Const` object during the inference process).
```suggestion
elif dataclasses.is_dataclass(o):
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]