From 5e9b86e6fe778f6b0b0f2484b06bb8ec065b6c3c Mon Sep 17 00:00:00 2001 From: Dmitrii Naumenko Date: Wed, 18 Aug 2021 18:07:38 +0300 Subject: [PATCH] update export.md: clarify how extensions are exported ```scala object Members { given x: Int = 4 given y: Comparable[String] with {override def compareTo(o: String): Int = ???} extension (s: String) { def ext1: String = ??? def ext2(p: Int) = ??? } } object Usage { export Members.* } ``` produces ```scala scalac: package { final lazy module val Members: Members = new Members() final module class Members() extends Object() { this: Members.type => final lazy given val x: Int = 4 final lazy module given val y: Members.y = new Members.y() final module class y() extends Object(), Comparable[String] { this: Members.y.type => override def compareTo(o: String): Int = ??? } extension (s: String) def ext1: String = ??? extension (s: String) def ext2(p: Int): Nothing = ??? } final lazy module val Usage: Usage = new Usage() final module class Usage() extends Object() { this: Usage.type => export Members.* extension (s: String) final def ext1: String = Members.ext1(s) extension (s: String) final def ext2(p: Int): Nothing = Members.ext2(s)(p) } } ``` --- docs/docs/reference/other-new-features/export.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/reference/other-new-features/export.md b/docs/docs/reference/other-new-features/export.md index a5918fdf93ca..2c693bf5bb3f 100644 --- a/docs/docs/reference/other-new-features/export.md +++ b/docs/docs/reference/other-new-features/export.md @@ -74,7 +74,7 @@ A member is _eligible_ if all of the following holds: It is a compile-time error if a simple or renaming selector does not identify any eligible members. Type members are aliased by type definitions, and term members are aliased by method definitions. Export aliases copy the type and value parameters of the members they refer to. -Export aliases are always `final`. Aliases of given instances are again defined as givens (and aliases of old-style implicits are `implicit`). Aliases of inline methods or values are again defined `inline`. There are no other modifiers that can be given to an alias. This has the following consequences for overriding: +Export aliases are always `final`. Aliases of given instances are again defined as givens (and aliases of old-style implicits are `implicit`). Aliases of extensions are again defined as extensions. Aliases of inline methods or values are again defined `inline`. There are no other modifiers that can be given to an alias. This has the following consequences for overriding: - Export aliases cannot be overridden, since they are final. - Export aliases cannot override concrete members in base classes, since they are