Skip to content

Commit

Permalink
Stabilise @publicInBinary (#22591)
Browse files Browse the repository at this point in the history
Closes #22497

Before merging this PR, the SIP committee still has to vote the
acceptance of the SIP.
  • Loading branch information
hamzaremmal authored Feb 22, 2025
2 parents 1279286 + 2bd5a47 commit 4dc4668
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 28 deletions.
1 change: 0 additions & 1 deletion library/src/scala/annotation/publicInBinary.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ package scala.annotation
* Adding this annotation to a non-public definition can also cause binary incompatibilities
* if the definition is accessed in an inline definition (these can be checked using `-WunstableInlineAccessors`).
*/
@experimental
final class publicInBinary extends scala.annotation.StaticAnnotation
4 changes: 2 additions & 2 deletions tests/neg/i22498.check
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Error: tests/neg/i22498.scala:7:32 ----------------------------------------------------------------------------------
7 | inline def proxy: Foo = new Foo(0) // error
-- Error: tests/neg/i22498.scala:5:32 ----------------------------------------------------------------------------------
5 | inline def proxy: Foo = new Foo(0) // error
| ^^^
| Private constructors used in inline methods require @publicInBinary
2 changes: 0 additions & 2 deletions tests/neg/i22498.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -experimental

import scala.annotation.publicInBinary

class Foo:
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/inline-unstable-accessors.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Werror -WunstableInlineAccessors -explain
//> using options -Werror -WunstableInlineAccessors -explain

package foo
import scala.annotation.publicInBinary
Expand Down
10 changes: 5 additions & 5 deletions tests/neg/publicInBinaryOverride.check
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- [E164] Declaration Error: tests/neg/publicInBinaryOverride.scala:10:15 ----------------------------------------------
10 | override def f(): Unit = () // error
| ^
| error overriding method f in class A of type (): Unit;
| method f of type (): Unit also needs to be declared with @publicInBinary
-- [E164] Declaration Error: tests/neg/publicInBinaryOverride.scala:8:15 -----------------------------------------------
8 | override def f(): Unit = () // error
| ^
| error overriding method f in class A of type (): Unit;
| method f of type (): Unit also needs to be declared with @publicInBinary
2 changes: 0 additions & 2 deletions tests/neg/publicInBinaryOverride.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -experimental

import scala.annotation.publicInBinary

class A:
Expand Down
2 changes: 1 addition & 1 deletion tests/pos-macros/i15413/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Werror -WunstableInlineAccessors
//> using options -Werror -WunstableInlineAccessors

import scala.quoted.*
import scala.annotation.publicInBinary
Expand Down
2 changes: 1 addition & 1 deletion tests/pos-macros/i15413b/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Werror -WunstableInlineAccessors
//> using options -Werror -WunstableInlineAccessors

package bar

Expand Down
2 changes: 0 additions & 2 deletions tests/pos-macros/i19526b/Test.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -experimental

package crash.test

case class Stack private[crash] (
Expand Down
3 changes: 0 additions & 3 deletions tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ val experimentalDefinitionInLibrary = Set(
"scala.annotation.into",
"scala.annotation.internal.$into",

//// New feature: @publicInBinary
"scala.annotation.publicInBinary",

//// New feature: Macro annotations
"scala.annotation.MacroAnnotation",

Expand Down
2 changes: 1 addition & 1 deletion tests/run/i13215.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Werror -WunstableInlineAccessors
//> using options -Werror -WunstableInlineAccessors

import scala.annotation.publicInBinary

Expand Down
2 changes: 0 additions & 2 deletions tests/run/i22497.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import scala.annotation.publicInBinary
import scala.annotation.experimental

@experimental
class Foo:
@publicInBinary private def this(i: Int) = this()
@publicInBinary protected def this(i: String) = this()

@experimental
@main def Test =
println(classOf[Foo].getConstructors().mkString("\n"))
2 changes: 0 additions & 2 deletions tests/run/i22498.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -experimental

import scala.annotation.publicInBinary

class Foo:
Expand Down
2 changes: 0 additions & 2 deletions tests/run/noProtectedSuper.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//> using options -experimental

import scala.annotation.publicInBinary

package p {
Expand Down
2 changes: 1 addition & 1 deletion tests/run/publicInBinary/Lib_1.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -experimental -Werror -WunstableInlineAccessors
//> using options -Werror -WunstableInlineAccessors

package foo

Expand Down

0 comments on commit 4dc4668

Please sign in to comment.