Add migration helpers for named tuples #21681
Labels
area:experimental:named-tuples
Issues tied to the named tuples feature.
itype:enhancement
Spree
Suitable for a future Spree
Compiler version
3.6
Minimized example
From the SIP 58 proposal, which was recently accepted:
There are some source incompatibilities involving named tuples of length one.
First, what was previously classified as an assignment could now be interpreted as a named tuple. Example:
This was an assignment in parentheses before, and is a named tuple of arity one now. It is however not idiomatic Scala code, since assignments are not usually enclosed in parentheses.
Second, what was a named argument to an infix operator can now be interpreted as a named tuple.
then
will now construct a tuple as second operand instead of passing a named parameter.
Expectation
These problems can be detected and diagnosed fairly straightforwardly: When faced with a unary named tuple, try to interpret it as an assignment, and if that succeeds, issue a migration error and suggest a workaround of these kinds:
The text was updated successfully, but these errors were encountered: