Type inference works incorrectly with tuple slices
Open
bug
core
P3
python
types
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
Returning a slice of the tuple doesn't alter the type inference output. For example:
`@beam.typehints.with_output_types(Tuple[int, str])`
`class Foo(beam.DoFn):`
` def process(self, a):`
` yield a, str(a)`
`pcoll = beam.Pipeline() `| beam.Create([1]) | beam.ParDo(Foo()) | beam.Map(lambda x: x[1:])
`print(pcoll.element_type)`
This prints Tuple[int, str], while the real type is str. At worst, this should return Any.
Imported from Jira [BEAM-12413](https://issues.apache.org/jira/browse/BEAM-12413). Original Jira may contain additional context.
Reported by: dmkozh.
Contributor guide
Assessment
This issue has not been assessed yet.