From a07abbbc8df5ffa4f4d818c4a9ceb498036747b7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 6 Oct 2021 17:51:54 +0200 Subject: [PATCH] Document where package objects are generated Fixes #13706 --- docs/docs/reference/dropped-features/package-objects.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/reference/dropped-features/package-objects.md b/docs/docs/reference/dropped-features/package-objects.md index 35e21d56a23c..d9099eef9805 100644 --- a/docs/docs/reference/dropped-features/package-objects.md +++ b/docs/docs/reference/dropped-features/package-objects.md @@ -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.