Skip to content

Regression macro between M3 and RC1 - transparent inline #11437

Closed
@julien-truffaut

Description

@julien-truffaut

Compiler version

This is an error we encountered when migrating Monocle from Scala 3.0.0-M3 to 3.0.0-RC1.

Here is the link to the build: https://github.com/optics-dev/Monocle/runs/1917837206

Minimized code

object GenPrism {
  transparent inline def apply[Source, Target <: Source] = 
    Focus[Source](_.as[Target])
}

object Focus {

  def apply[S] = new MkFocus[S]

  class MkFocus[From] {
    transparent inline def apply[To](inline lambda: (From => To)): Any = 
      ${ FocusImpl('lambda) }
  }
}

Output

[error] -- Error: /Users/julien/project/Monocle/macro/src/main/scala-3.x/monocle/macros/GenPrism.scala:8:22
[error] 8 |    Focus[Source](_.as[Target])
[error]   |                  ^^^^^^^^^^^^
[error]   |              class Nothing in package scala does not take type parameters
[error] -- Error: /Users/julien/project/Monocle/macro/src/main/scala-3.x/monocle/macros/GenPrism.scala:7:25
[error] 7 |  transparent inline def apply[Source, Target <: Source] =
[error]   |                         ^
[error]   |                         `transparent` can only be used for inline methods

Expectation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions