@@ -62,7 +62,7 @@ object language {
6262 *
6363 * @group production
6464 */
65- @ volatile implicit lazy val dynamics : dynamics = languageFeature.dynamics
65+ implicit lazy val dynamics : dynamics = languageFeature.dynamics
6666
6767 /** Only where enabled, postfix operator notation `(expr op)` will be allowed.
6868 *
@@ -73,7 +73,7 @@ object language {
7373 *
7474 * @group production
7575 */
76- @ volatile implicit lazy val postfixOps : postfixOps = languageFeature.postfixOps
76+ implicit lazy val postfixOps : postfixOps = languageFeature.postfixOps
7777
7878 /** Only where enabled, accesses to members of structural types that need
7979 * reflection are supported. Reminder: A structural type is a type of the form
@@ -91,7 +91,7 @@ object language {
9191 *
9292 * @group production
9393 */
94- @ volatile implicit lazy val reflectiveCalls : reflectiveCalls = languageFeature.reflectiveCalls
94+ implicit lazy val reflectiveCalls : reflectiveCalls = languageFeature.reflectiveCalls
9595
9696 /** Only where enabled, definitions of legacy implicit conversions and certain uses
9797 * of implicit conversions are allowed.
@@ -139,7 +139,7 @@ object language {
139139 *
140140 * @group production
141141 */
142- @ volatile implicit lazy val implicitConversions : implicitConversions = languageFeature.implicitConversions
142+ implicit lazy val implicitConversions : implicitConversions = languageFeature.implicitConversions
143143
144144 /** Only where this flag is enabled, higher-kinded types can be written.
145145 *
@@ -162,7 +162,7 @@ object language {
162162 *
163163 * @group production
164164 */
165- @ volatile implicit lazy val higherKinds : higherKinds = languageFeature.higherKinds
165+ implicit lazy val higherKinds : higherKinds = languageFeature.higherKinds
166166
167167 /** Only where enabled, existential types that cannot be expressed as wildcard
168168 * types can be written and are allowed in inferred types of values or return
@@ -180,7 +180,7 @@ object language {
180180 *
181181 * @group production
182182 */
183- @ volatile implicit lazy val existentials : existentials = languageFeature.existentials
183+ implicit lazy val existentials : existentials = languageFeature.existentials
184184
185185 /** The experimental object contains features that have been recently added but have not
186186 * been thoroughly tested in production yet.
@@ -209,7 +209,7 @@ object language {
209209 * '''Why control it?''' For their very power, macros can lead to code that is hard
210210 * to debug and understand.
211211 */
212- @ volatile implicit lazy val macros : macros = languageFeature.experimental.macros
212+ implicit lazy val macros : macros = languageFeature.experimental.macros
213213 }
214214
215215 /** Where imported, a backwards compatibility mode for Scala2 is enabled */
@@ -218,6 +218,24 @@ object language {
218218 /** Where imported, auto-tupling is disabled */
219219 object noAutoTupling
220220
221- /** Where imported loose equality using eqAny is disabled */
221+ /** Where imported, loose equality using eqAny is disabled */
222222 object strictEquality
223+
224+ /** Where imported, ad hoc extensions of non-open classes in other
225+ * compilation units are allowed.
226+ *
227+ * '''Why control the feature?''' Ad-hoc extensions should usually be avoided
228+ * since they typically cannot reply on an "internal" contract between a class
229+ * and its extensions. Only open classes need to specify such a contract.
230+ * Ad-hoc extensions might break for future versions of the extended class,
231+ * since the extended class is free to change its implementation without
232+ * being constrained by an internal contract.
233+ *
234+ * '''Why allow it?''' An ad-hoc extension can sometimes be necessary,
235+ * for instance when mocking a class in a testing framework, or to work
236+ * around a bug or missing feature in the original class. Nevertheless,
237+ * such extensions should be limited in scope and clearly documented.
238+ * That's why the language import is required for them.
239+ */
240+ object adhocExtensions
223241}
0 commit comments