Skip to content

Bad interaction between overloading, export, and inline (possibly misleading error message) #7700

Closed
@morgen-peschke

Description

@morgen-peschke

I'm getting an unexpected error message when trying to export an inline definition:

[error] 12 |  export Macros.show
[error]    |         ^^^^^^
[error]    |         method show is declared as erased, but is in fact used

minimized code

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

In this case, the inline doesn't make much sense, in the larger version it's a macro which has been moved to a separate file so it can be used within Show.scala.

expectation

I'd like to be able to present the full API in a central location, with minimal import tax. It's reasonable to expect the users to import Show.show or Show.given, but not really reasonable to expect them to import Show.show and macros.Show.show, if it's at all avoidable.

If this is something that is not supported, I'd expect a more relevant error message, as erased isn't part of the (visible) definitions.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions