Skip to content

Type evaluation for 'Tuple.apply()' shows surprising behavior #11977

Closed
@MRandl

Description

@MRandl

Compiler version

tested on rc1 and rc2, linux and windows. Also replicates on Scastie.

Minimized code

def add(a : (Int, String), b : (Int, String)) : (Int, String) = (a(0) + b(0), a(1) + b(1))

Output

(a(0) + b(0), ...) <- Found Long, required Int

Expectation

You would expect this code to compile correctly and accept the fact that a(0) + b(0) is an Int and not a Long

Workaround

Replacing a(0) + b(0) by a._1 + b._1 makes it work correctly

Anton Sviridov on Gitter greatly simplified my original problematic code

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugregressionThis worked in a previous version but doesn't anymore

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions