Skip to content

Stabilise @publicInBinary #22591

New issue

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

Merged
merged 2 commits into from
Feb 22, 2025
Merged
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
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
Loading