Skip to content

Commit 4dc4668

Browse files
authored
Stabilise @publicInBinary (#22591)
Closes #22497 Before merging this PR, the SIP committee still has to vote the acceptance of the SIP.
2 parents 1279286 + 2bd5a47 commit 4dc4668

15 files changed

+12
-28
lines changed

Diff for: library/src/scala/annotation/publicInBinary.scala

-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ package scala.annotation
1616
* Adding this annotation to a non-public definition can also cause binary incompatibilities
1717
* if the definition is accessed in an inline definition (these can be checked using `-WunstableInlineAccessors`).
1818
*/
19-
@experimental
2019
final class publicInBinary extends scala.annotation.StaticAnnotation

Diff for: tests/neg/i22498.check

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Error: tests/neg/i22498.scala:7:32 ----------------------------------------------------------------------------------
2-
7 | inline def proxy: Foo = new Foo(0) // error
1+
-- Error: tests/neg/i22498.scala:5:32 ----------------------------------------------------------------------------------
2+
5 | inline def proxy: Foo = new Foo(0) // error
33
| ^^^
44
| Private constructors used in inline methods require @publicInBinary

Diff for: tests/neg/i22498.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -experimental
2-
31
import scala.annotation.publicInBinary
42

53
class Foo:

Diff for: tests/neg/inline-unstable-accessors.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -experimental -Werror -WunstableInlineAccessors -explain
1+
//> using options -Werror -WunstableInlineAccessors -explain
22

33
package foo
44
import scala.annotation.publicInBinary

Diff for: tests/neg/publicInBinaryOverride.check

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- [E164] Declaration Error: tests/neg/publicInBinaryOverride.scala:10:15 ----------------------------------------------
2-
10 | override def f(): Unit = () // error
3-
| ^
4-
| error overriding method f in class A of type (): Unit;
5-
| method f of type (): Unit also needs to be declared with @publicInBinary
1+
-- [E164] Declaration Error: tests/neg/publicInBinaryOverride.scala:8:15 -----------------------------------------------
2+
8 | override def f(): Unit = () // error
3+
| ^
4+
| error overriding method f in class A of type (): Unit;
5+
| method f of type (): Unit also needs to be declared with @publicInBinary

Diff for: tests/neg/publicInBinaryOverride.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -experimental
2-
31
import scala.annotation.publicInBinary
42

53
class A:

Diff for: tests/pos-macros/i15413/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -experimental -Werror -WunstableInlineAccessors
1+
//> using options -Werror -WunstableInlineAccessors
22

33
import scala.quoted.*
44
import scala.annotation.publicInBinary

Diff for: tests/pos-macros/i15413b/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -experimental -Werror -WunstableInlineAccessors
1+
//> using options -Werror -WunstableInlineAccessors
22

33
package bar
44

Diff for: tests/pos-macros/i19526b/Test.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -experimental
2-
31
package crash.test
42

53
case class Stack private[crash] (

Diff for: tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ val experimentalDefinitionInLibrary = Set(
3939
"scala.annotation.into",
4040
"scala.annotation.internal.$into",
4141

42-
//// New feature: @publicInBinary
43-
"scala.annotation.publicInBinary",
44-
4542
//// New feature: Macro annotations
4643
"scala.annotation.MacroAnnotation",
4744

Diff for: tests/run/i13215.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -experimental -Werror -WunstableInlineAccessors
1+
//> using options -Werror -WunstableInlineAccessors
22

33
import scala.annotation.publicInBinary
44

Diff for: tests/run/i22497.scala

-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import scala.annotation.publicInBinary
44
import scala.annotation.experimental
55

6-
@experimental
76
class Foo:
87
@publicInBinary private def this(i: Int) = this()
98
@publicInBinary protected def this(i: String) = this()
109

11-
@experimental
1210
@main def Test =
1311
println(classOf[Foo].getConstructors().mkString("\n"))

Diff for: tests/run/i22498.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -experimental
2-
31
import scala.annotation.publicInBinary
42

53
class Foo:

Diff for: tests/run/noProtectedSuper.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//> using options -experimental
2-
31
import scala.annotation.publicInBinary
42

53
package p {

Diff for: tests/run/publicInBinary/Lib_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -experimental -Werror -WunstableInlineAccessors
1+
//> using options -Werror -WunstableInlineAccessors
22

33
package foo
44

0 commit comments

Comments
 (0)