We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
3.7.2-RC1-bin-20250520-baac46c-NIGHTLY-git-baac46c
class Test: def f1: (Int, Int) = (1, 2) def test1 = val (a, b) = f1 a + b
After typer: scala compile --server=false -S 3.nightly -Xprint:typer tuples.scala
scala compile --server=false -S 3.nightly -Xprint:typer tuples.scala
package <empty> { class Test() extends Object() { def f1: Tuple2[Int, Int] = Tuple2.apply[Int, Int](1, 2) def test1: Int = { val $1$: (Int, Int) = this.f1:(Int, Int) @unchecked match { case Tuple2.unapply[Int, Int](a @ _, b @ _) => Tuple2.apply[Int, Int](a, b) } val a: Int = $1$._1 val b: Int = $1$._2 a + b } } }
After genBCode: scala compile --server=false -S 3.nightly -Xprint:genBCode tuples.scala
scala compile --server=false -S 3.nightly -Xprint:genBCode tuples.scala
package <empty> { @SourceFile("tuples.scala") class Test extends Object { def <init>(): Unit = { super() () } def f1(): Tuple2 = new Tuple2$mcII$sp(1, 2) def test1(): Int = { val $1$: Tuple2 = matchResult1[Tuple2]: { case val x1: Tuple2 = this.f1():Tuple2 if x1 ne null then { case val a: Int = x1._1$mcI$sp() case val b: Int = x1._2$mcI$sp() return[matchResult1] new Tuple2$mcII$sp(a, b) } else () throw new MatchError(x1) } val a: Int = $1$._1$mcI$sp() val b: Int = $1$._2$mcI$sp() a + b } } }
Calling _i on the tuple directly:
_i
val $1$: (Int, Int) = this.f1:(Int, Int) val a: Int = $1$._1 val b: Int = $1$._2 a + b
The text was updated successfully, but these errors were encountered:
When typing a PatDef(mods, pats, tpt, rhs), instead of passing to desuger directly, we type check rhs first.
PatDef(mods, pats, tpt, rhs)
rhs
In makePatDef, we update tupleOptimizable, and we will apply optimisation if:
makePatDef
tupleOptimizable
pat
(x1, x2, ..., xN)
Sorry, something went wrong.
No branches or pull requests
Compiler version
3.7.2-RC1-bin-20250520-baac46c-NIGHTLY-git-baac46c
Minimized example
Output
After typer:
scala compile --server=false -S 3.nightly -Xprint:typer tuples.scala
After genBCode:
scala compile --server=false -S 3.nightly -Xprint:genBCode tuples.scala
Expectation
Calling
_i
on the tuple directly:The text was updated successfully, but these errors were encountered: