Skip to content

Commit b217b3d

Browse files
authored
Merge pull request scala#13708 from dotty-staging/fix-13706
Document where package objects are generated
2 parents f8f9295 + a07abbb commit b217b3d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/docs/reference/dropped-features/package-objects.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ The compiler generates synthetic objects that wrap top-level definitions falling
3434
- implicit classes and objects,
3535
- companion objects of opaque type aliases.
3636

37-
If a source file `src.scala` contains such top-level definitions, they will be put in a synthetic object named `src$package`. The wrapping is transparent, however. The definitions in `src` can still be accessed as members of the enclosing package.
37+
If a source file `src.scala` contains such top-level definitions, they will be put in a synthetic object named `src$package`. The wrapping is transparent, however. The definitions in `src` can still be accessed as members of the enclosing package. The synthetic object will be placed last in the file,
38+
after any other package clauses, imports, or object and class definitions.
3839

3940
**Note:** This means that
4041
1. The name of a source file containing wrapped top-level definitions is relevant for binary compatibility. If the name changes, so does the name of the generated object and its class.

0 commit comments

Comments
 (0)