Skip to content

Commit 9bad8bc

Browse files
authored
Merge pull request #7702 from dotty-staging/gfix-#7700
Fix #7700: Export forwarders of inline methods are themselves inline
2 parents 6e19362 + 56cfeb9 commit 9bad8bc

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ object Flags {
507507
val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags | Enum
508508

509509
/** Flags retained in export forwarders */
510-
val RetainedExportFlags = Given | Implicit | Extension
510+
val RetainedExportFlags = Given | Implicit | Extension | Inline
511511

512512
/** Flags that apply only to classes */
513513
val ClassOnlyFlags = Sealed | Open | Abstract.toTypeFlags

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ It is a compile-time error if a simple or renaming selector does not identify an
7070
members.
7171

7272
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.
73-
Export aliases are always `final`. Aliases of given instances are again defined as givens (and aliases of old-style implicits are `implicit`). There are no other modifiers that can be given to an alias. This has the following consequences for overriding:
73+
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:
7474

7575
- Export aliases cannot be overridden, since they are final.
7676
- Export aliases cannot override concrete members in base classes, since they are
@@ -119,7 +119,6 @@ class B { val c: Int }
119119
object a { val b = new B }
120120
export a._
121121
export b._
122-
}
123122
```
124123
Is the `export b._` clause legal? If yes, what does it export? Is it equivalent to `export a.b._`? What about if we swap the last two clauses?
125124
```

tests/pos/i7700.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package test
2+
3+
trait Show[-A]
4+
def show(a: A): String
5+
6+
object Macros
7+
inline def (sc: StringContext) show(args: =>Any*): String = ???
8+
9+
object Show
10+
def[A] (a: A) show(given S: Show[A]): String = S.show(a)
11+
12+
export Macros.show

0 commit comments

Comments
 (0)