Skip to content

Fix #7700: Export forwarders of inline methods are themselves inline #7702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ object Flags {
val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags | Enum

/** Flags retained in export forwarders */
val RetainedExportFlags = Given | Implicit | Extension
val RetainedExportFlags = Given | Implicit | Extension | Inline

/** Flags that apply only to classes */
val ClassOnlyFlags = Sealed | Open | Abstract.toTypeFlags
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/reference/other-new-features/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ It is a compile-time error if a simple or renaming selector does not identify an
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`). 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 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
Expand Down Expand Up @@ -119,7 +119,6 @@ class B { val c: Int }
object a { val b = new B }
export a._
export b._
}
```
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?
```
Expand Down
12 changes: 12 additions & 0 deletions tests/pos/i7700.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package test

trait Show[-A]
def show(a: A): String

object Macros
inline def (sc: StringContext) show(args: =>Any*): String = ???

object Show
def[A] (a: A) show(given S: Show[A]): String = S.show(a)

export Macros.show