Skip to content
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

Broken inline accessor on package #19237

Open
nicolasstucki opened this issue Dec 11, 2023 · 0 comments
Open

Broken inline accessor on package #19237

nicolasstucki opened this issue Dec 11, 2023 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

Compiler version

3.1, 3.2, 3.3

Minimized code

package mono

trait C
private[mono] object Focus:
  import internals.FocusImpl
  class MkFocus[From]:
    transparent inline def apply[To](inline f: C ?=> From => To): Any =
      ${ FocusImpl('f) }

package internals {
  import scala.quoted.*

  private[mono] object FocusImpl:
    def apply[From: Type, To: Type](f: Expr[C ?=> From => To])(using Quotes): Expr[Any] =
      ???
}

Output

[[syntax trees at end of                     typer]] // t/Test.scala
...
def inline$FocusImpl$i1(x$0: mono.internals): mono.internals.FocusImpl =
        x$0.FocusImpl
...

Expectation

We should not add the parameter that abstracts over the package.

@nicolasstucki nicolasstucki self-assigned this Dec 11, 2023
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2023
sjrd added a commit to sjrd/tasty-query that referenced this issue Dec 18, 2023
It does not seem that the upstream issue will be fixed any time
soon due to binary compatibility concerns. Nevertheless, it makes
no sense, and it is not possible possible to create a *value* of
a "package type".

Therefore, we work around the issue by tolerating a `PackageRef`
as the type of a PARAM of an inline accessor method. We replace it
by `Nothing`, which matches the fact that no value can be created
for it.

Note that the *signature* and therefore the *signed name* of such
a method will be different from what dotc computes, so it will
still be semantically broken.
sjrd added a commit to scalacenter/tasty-query that referenced this issue Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant