Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: doc-page
title: "Automatic Parameter Unrolling"
nightlyOf: https://docs.scala-lang.org/scala3/reference/experimental/unrolled-defs.html
nightlyOf: https://docs.scala-lang.org/scala3/reference/preview/unrolled-defs.html
---

Parameter unrolling enables new parameters to be added to methods and classes,
Expand Down
2 changes: 1 addition & 1 deletion docs/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ subsection:
index: reference/preview/overview.md
subsection:
- page: reference/preview/into.md
- page: reference/preview/unrolled-defs.md
- title: Experimental Features
directory: experimental
index: reference/experimental/overview.md
Expand Down Expand Up @@ -178,7 +179,6 @@ subsection:
- page: reference/experimental/tupled-function.md
- page: reference/experimental/modularity.md
- page: reference/experimental/typeclasses.md
- page: reference/experimental/unrolled-defs.md
- page: reference/experimental/package-object-values.md
- page: reference/experimental/quoted-patterns-with-polymorphic-functions.md
- page: reference/experimental/relaxed-lambdas.md
Expand Down
3 changes: 2 additions & 1 deletion library/src/scala/annotation/unroll.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package scala.annotation

import language.experimental.captureChecking
import scala.annotation.internal.preview

@experimental("under review as part of SIP-61")
@preview
/**The `@unroll` annotation is reserved for parameters of classes and methods.
*
* It enables to add new parameters while preserving backwards binary compatibility,
Expand Down
2 changes: 1 addition & 1 deletion repl/test/dotty/tools/repl/ReplCompilerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ class ReplHighlightTests extends ReplTest(ReplTest.defaultOptions.filterNot(_.st
def deepTree(depth: Int): Tree
deepTree(300)""")

class ReplUnrollTests extends ReplTest(ReplTest.defaultOptions ++ Seq("-experimental", "-Xprint:pickler")):
class ReplUnrollTests extends ReplTest(ReplTest.defaultOptions ++ Seq("-preview", "-Xprint:pickler")):
override val redirectOutput = true
@Test def i23408: Unit = initially:
run("""
Expand Down
2 changes: 1 addition & 1 deletion sbt-test/tasty-compat/add-param-unroll/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lazy val commonSettings = Seq(
scalacOptions += "-experimental",
scalacOptions += "-preview",
)

lazy val printSettings = Seq(
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-abstractMethod.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-clash.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-clause-interleaving.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-duped.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-illegal.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-illegal2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-illegal3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-multipleParams.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-no-default.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Vprint:unrollDefs
//> using options -preview -Vprint:unrollDefs

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unroll-traitConstructor.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
7 changes: 4 additions & 3 deletions tests/pos/i22833-unroll-final-class.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import scala.annotation.{experimental,unroll}
//> using options -preview
import scala.annotation.unroll

@experimental final class Foo {
final class Foo {
def bar(@unroll x: Int = 0) = x + 1
}
}
3 changes: 0 additions & 3 deletions tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ val experimentalDefinitionInLibrary = Set(
// Need quotedPatternsWithPolymorphicFunctions enabled.
"scala.quoted.runtime.Patterns$.higherOrderHoleWithTypes",

// New feature: SIP 61 - @unroll annotation
"scala.annotation.unroll",

// New feature: Erased trait
"scala.compiletime.Erased",
)
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-caseclass-integration/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-caseclass-integration/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-classMethod-integration/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-classMethod-integration/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-clause-interleaving/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-clause-interleaving/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-inferredFinal.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-multiple.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll
import scala.deriving.Mirror
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-objectMethod-integration/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-objectMethod-integration/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-traitMethod-integration/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-traitMethod-integration/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview
package unroll

import scala.annotation.unroll
Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-value-class/Unrolled_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
2 changes: 1 addition & 1 deletion tests/run/unroll-value-class/Unrolled_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental
//> using options -preview

import scala.annotation.unroll

Expand Down
Loading