Skip to content

Commit

Permalink
Merge pull request #13708 from dotty-staging/fix-13706
Browse files Browse the repository at this point in the history
Document where package objects are generated
  • Loading branch information
smarter committed Oct 7, 2021
2 parents f8f9295 + a07abbb commit b217b3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/docs/reference/dropped-features/package-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ The compiler generates synthetic objects that wrap top-level definitions falling
- implicit classes and objects,
- companion objects of opaque type aliases.

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.
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,
after any other package clauses, imports, or object and class definitions.

**Note:** This means that
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.
Expand Down

0 comments on commit b217b3d

Please sign in to comment.