Skip to content

Commit f1dbf18

Browse files
committed
Add comment on private[C] and public binary API compatibility
1 parent 46bd277 commit f1dbf18

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

content/binary-api.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Using references to `@publicInBinary` in inline code can cause binary incompatib
239239

240240
### Other concerns
241241

242-
* Tools that analyze inlined TASTy code might need to know about `@publicInBinary`. For example [MiMa](https://github.com/lightbend/mima/) and [TASTy MiMa](https://github.com/scalacenter/tasty-mima).
242+
* Tools that analyze inlined TASTy code will need to know about `@publicInBinary`. For example [MiMa](https://github.com/lightbend/mima/) and [TASTy MiMa](https://github.com/scalacenter/tasty-mima).
243243

244244
## Alternatives
245245

@@ -249,6 +249,20 @@ This annotation would generate an stable accessor. This annotation could be used
249249
* Implementation https://github.com/lampepfl/dotty/pull/16992
250250

251251

252+
### Make all `private[C]` part of the binary API
253+
254+
Currently, we already make `private[C]` public in the binary API but do not guarantee but do not have the same guarantees regarding binary compatibility.
255+
For example, the following change is binary compatible but would remove the existence of the `private[C]` definition in the bytecode.
256+
```diff
257+
class C:
258+
- private[C] def f: T = ...
259+
```
260+
We could change the rules to make all `private[C]` part of binary compatible to flag such a change as binary incompatible. This would imply that all these
261+
methods can be accessed directly from inline methods without generating an accessor.
262+
263+
The drawback of this approach is that that we would need to force users to keep their `private[C]` methods even if they never used inline methods.
264+
265+
252266
## Related work
253267

254268
* Initial discussions: [https://github.com/lampepfl/dotty/issues/16983](https://github.com/lampepfl/dotty/issues/16983)

0 commit comments

Comments
 (0)