-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle & and | types when computing tuple arity #15330
Conversation
8d036aa
to
a6e6c64
Compare
*/ | ||
def tupleArity(relaxEmptyTuple: Boolean = false)(using Context): Int = self match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: I think this will affect the RefinedPrinter which will no longer pretty print generic tuple types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok it seems to work for refined printer I see you made the change, disregard all :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other that may read this thread: the important thing here is that tupleElementTypes
handles the EmptyTuple
type alias but tupleArity
does not (see comment on dealiasing)
There are cases where we know the tuple arity but cannot know the flat element types of the tuple. For example `(A, B) | (C, D)` has arity 2 but we cannot create a single tuple containing these elements. In tupleArity we are missing a dealias. We need to investigate this further. At first glance it seems that the signature of `Tuple.apply(x)` is erased to `(Object): Product` and not `(Object): Tuple1`. This would have been caused be the missing dealias. Unfortunately, if this is the case we might not be able to fix the erasure without breaking binary compatibility of the standard library.
Fixes #15302