Skip to content
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

Automatic expansion of Tuple1 #12797

Closed
Adam-Vandervorst opened this issue Jun 12, 2021 · 2 comments
Closed

Automatic expansion of Tuple1 #12797

Adam-Vandervorst opened this issue Jun 12, 2021 · 2 comments

Comments

@Adam-Vandervorst
Copy link

Compiler version

3.0.0

Minimized code

def g(a: Tuple1[Int]) = a._1*2

@main def main_f = 
    println(g(1))

Output

Found:    (1 : Int)
Required: Tuple1[Int]
    println(g(1))

Expectation

Work the same as

def f(a: Tuple2[Int, Int]) = a._1 + a._2

@main def main_f = 
    println(f(1, 2))

or work with g((1)), g((1,)), or g(1,).

@smarter
Copy link
Member

smarter commented Jun 12, 2021

Scala 2 has the same behavior so this isn't a regression but more like a feature request. And the direction we're trying to go in involves less auto-tupling, not more of it, cf #4311 which is closed but the discussion isn't settled yet.

@smarter smarter closed this as completed Jun 12, 2021
@Adam-Vandervorst
Copy link
Author

Adam-Vandervorst commented Jun 12, 2021

In my opinion, this inconsistent with

def op[T <: NonEmptyTuple](name: String)(ps: Map[T, AOp]) = AOp[T](name, ps)

where you can define your ops and do biop(x, y) but not uop(x).
EDIT:
Ideally this would use varargs, but that can not be used with the partial application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants