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

support val with pattern of > 22 subpats #8468

Open
scabug opened this issue Apr 2, 2014 · 9 comments
Open

support val with pattern of > 22 subpats #8468

scabug opened this issue Apr 2, 2014 · 9 comments

Comments

@scabug
Copy link

scabug commented Apr 2, 2014

I tried this in a standalone App object and in the REPL with identical outcome.

Reproduce code:

  type A = Int
  case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A)
  val foo = Foo(1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6)
  val Foo(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = foo

Expected result:
compiles fine

Actual result:

[error] object <none> is not a member of package scala
[error]   val Foo(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = foo
[error]          ^
[error] one error found

Same happens for

val Foo(1,2,3,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = foo

But not for

val Foo(1,2,3,4,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = foo

which compiles fine, as it matches only 22 values.

@scabug
Copy link
Author

scabug commented Apr 2, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8468?orig=1
Reporter: @cvogt
Affected Versions: 2.11.0-RC3
See #7296

@scabug
Copy link
Author

scabug commented Apr 2, 2014

@adriaanm said:
This is not a blocker since it's a new feature (thus not a regression) and it has a workaround:

 foo match { case Foo(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) => }

@scabug
Copy link
Author

scabug commented Apr 2, 2014

@adriaanm said:
The problem with the value definition that uses a pattern is that its translation uses Option[TupleN] under the hood, and we don't have enough tuples :-)

@scabug
Copy link
Author

scabug commented Apr 2, 2014

@xeno-by said:
What about name-based patmat?

@tOverney
Copy link

are there still plans to support this?

@SethTisue SethTisue added this to the Backlog milestone Nov 15, 2019
@scala scala deleted a comment from scabug Nov 15, 2019
@SethTisue
Copy link
Member

SethTisue commented Nov 15, 2019

not in Scala 2. I don't know what the Scala 3 situation is on this. if someone wants to check on it we could perhaps add the "fixed in Dotty" label, if it is fixed.

I'm pretty tempted to just close the ticket as further changes in this area in Scala 2 seem quite unlikely. Someone from the community would have to step forward with a proposal and then follow it up with an implementation, too.

@adriaanm
Copy link
Contributor

I believe the 22 limit has been lifted fully in dotty, so this will be fixed in 3

@tOverney
Copy link

@adriaanm good to know! Thanks!

@SethTisue make sense! thanks for the answer!

@Jasper-M
Copy link
Member

Dotty currently gives value _1 is not a member of (A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A). Perhaps best to open an issue for dotty.

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

5 participants