Skip to content

Commit 7ff2398

Browse files
committed
Stabilise SIP-47
1 parent f880d6e commit 7ff2398

28 files changed

+24
-78
lines changed

compiler/src/dotty/tools/dotc/config/Feature.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ object Feature:
3030
val symbolLiterals = deprecated("symbolLiterals")
3131
val fewerBraces = experimental("fewerBraces")
3232
val saferExceptions = experimental("saferExceptions")
33-
val clauseInterleaving = experimental("clauseInterleaving")
3433
val pureFunctions = experimental("pureFunctions")
3534
val captureChecking = experimental("captureChecking")
3635
val into = experimental("into")
@@ -60,7 +59,6 @@ object Feature:
6059
(symbolLiterals, "Allow symbol literals"),
6160
(fewerBraces, "Enable support for using indentation for arguments"),
6261
(saferExceptions, "Enable safer exceptions"),
63-
(clauseInterleaving, "Enable clause interleaving"),
6462
(pureFunctions, "Enable pure functions for capture checking"),
6563
(captureChecking, "Enable experimental capture checking"),
6664
(into, "Allow into modifier on parameter types"),
@@ -121,8 +119,6 @@ object Feature:
121119

122120
def namedTypeArgsEnabled(using Context) = enabled(namedTypeArguments)
123121

124-
def clauseInterleavingEnabled(using Context) = enabled(clauseInterleaving)
125-
126122
def genericNumberLiteralsEnabled(using Context) = enabled(genericNumberLiterals)
127123

128124
def scala2ExperimentalMacroEnabled(using Context) = enabled(scala2macros)

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,16 +3877,7 @@ object Parsers {
38773877
val mods1 = addFlag(mods, Method)
38783878
val ident = termIdent()
38793879
var name = ident.name.asTermName
3880-
val paramss =
3881-
if in.featureEnabled(Feature.clauseInterleaving) then
3882-
// If you are making interleaving stable manually, please refer to the PR introducing it instead, section "How to make non-experimental"
3883-
typeOrTermParamClauses(ParamOwner.Def, numLeadParams)
3884-
else
3885-
val tparams = typeParamClauseOpt(ParamOwner.Def)
3886-
val vparamss = termParamClauses(ParamOwner.Def, numLeadParams)
3887-
3888-
joinParams(tparams, vparamss)
3889-
3880+
val paramss = typeOrTermParamClauses(ParamOwner.Def, numLeadParams)
38903881
var tpt = fromWithinReturnType { typedOpt() }
38913882

38923883
if (migrateTo3) newLineOptWhenFollowedBy(LBRACE)

docs/_docs/reference/experimental/generalized-method-syntax.md renamed to docs/_docs/reference/other-new-features/generalized-method-syntax.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
---
22
layout: doc-page
33
title: "Generalized Method Syntax"
4-
nightlyOf: https://docs.scala-lang.org/scala3/reference/experimental/generalized-method-syntax.html
4+
nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/generalized-method-syntax.html
55
---
66

7-
This feature is not yet part of the Scala 3 language definition. It can be made available by a language import:
8-
9-
```scala
10-
import scala.language.experimental.clauseInterleaving
11-
```
12-
137
The inclusion of using clauses is not the only way in which methods have been updated, type parameter clauses are now allowed in any number and at any position.
148

159
## Syntax Changes
@@ -51,7 +45,7 @@ trait DB {
5145
}
5246
```
5347

54-
Note that simply replacing `V` by `k.Value` would not be equivalent. For example, if `k.Value` is `Some[Int]`, only the above allows:
48+
Note that simply replacing `V` by `k.Value` would not be equivalent. For example, if `k.Value` is `Some[Int]`, only the above allows:
5549
`getOrElse(k)[Option[Int]](None)`, which returns a `Number`.
5650

5751
## Details

library/src/scala/runtime/stdLibPatches/language.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ object language:
6767
* @see [[https://github.com/scala/improvement-proposals/blob/main/content/clause-interleaving.md]]
6868
*/
6969
@compileTimeOnly("`clauseInterleaving` can only be used at compile time in import statements")
70+
@deprecated("`clauseInterleaving` is now standard, no language import is needed", since = "3.6")
7071
object clauseInterleaving
7172

7273
/** Experimental support for pure function type syntax

presentation-compiler/test/dotty/tools/pc/tests/signaturehelp/SignatureHelpInterleavingSuite.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import java.nio.file.Path
88

99
class SignatureHelpInterleavingSuite extends BaseSignatureHelpSuite:
1010

11-
override protected def scalacOptions(classpath: Seq[Path]): Seq[String] =
12-
List("-language:experimental.clauseInterleaving")
13-
1411
@Test def `proper-position-1` =
1512
check(
1613
"""

scaladoc-testcases/src/tests/extensionParams.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ extension (using Unit)(a: Int)
6161
def f14(): Any
6262
= ???
6363

64-
import scala.language.experimental.clauseInterleaving
65-
6664
extension (using String)(using Int)(a: Animal)(using Unit)(using Number)
6765
def f16(b: Any)[T](c: T): T
6866
= ???

scaladoc-testcases/src/tests/methodsAndConstructors.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package tests.methodsAndConstructors
22

3-
import scala.language.experimental.clauseInterleaving
4-
53
class A
64
class B extends A
75
class C

tests/neg/interleaving-ab.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import scala.language.experimental.clauseInterleaving
21

32
object Ab:
43
given String = ""
54
given Double = 0
65

76
def illegal[A][B](x: A)(using B): B = summon[B] // error: Type parameter lists must be separated by a term or using parameter list
8-
7+
98
def ab[A](x: A)[B](using B): B = summon[B]
109
def test =
1110
ab[Int](0: Int) // error

tests/neg/interleaving-params.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import scala.language.experimental.clauseInterleaving
21

32
class Params{
43
def bar[T](x: T)[T]: String = ??? // error

tests/neg/interleaving-signatureCollision.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import scala.language.experimental.clauseInterleaving
21

32
object signatureCollision:
43
def f[T](x: T)[U](y: U) = (x,y)

0 commit comments

Comments
 (0)