Skip to content

Commit 5e9b86e

Browse files
authored
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 <empty> { 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) } } ```
1 parent 6744d63 commit 5e9b86e

File tree

1 file changed

+1
-1
lines changed
  • docs/docs/reference/other-new-features

1 file changed

+1
-1
lines changed

docs/docs/reference/other-new-features/export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ A member is _eligible_ if all of the following holds:
7474
It is a compile-time error if a simple or renaming selector does not identify any eligible members.
7575

7676
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.
77-
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:
77+
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:
7878

7979
- Export aliases cannot be overridden, since they are final.
8080
- Export aliases cannot override concrete members in base classes, since they are

0 commit comments

Comments
 (0)