Skip to content

Conversation

nalimilan
Copy link
Member

The current version returns a type which is narrower than what typejoin computes, which can make broadcast fail. Return Any until we develop code to compute the same result as typejoin, as this is only used for inference.

Fixes #38422.

@vtjnash @JeffBezanson This is the simplest fix I could find, but please feel free to suggest better ways to compute the actual type that typejoin would return.

The current version returns a type which is narrower than what `typejoin`
computes, which can make `broadcast` fail. Return `Any` until we develop code to
compute the same result as `typejoin`, as this is only used for inference.
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the permissive version might be:

var = TypeVar(T.var.name)
T = UnionAll(var, promote_typejoin_union(T{var}))

but I'm not sure if that's necessarily worthwhile.

@nalimilan
Copy link
Member Author

OK, let's merge this, and keep discussing the better approach.

@JeffBezanson Do you have an opinion?

@nalimilan nalimilan merged commit f0046a0 into master Nov 17, 2020
@nalimilan nalimilan deleted the nl/promote_typejoin_union branch November 17, 2020 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type assert error in broadcasting on nightly

2 participants