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

Surface.methodsOf for Enumeration fails in Scala 3 #3411

Open
OndrejSpanel opened this issue Feb 25, 2024 · 1 comment
Open

Surface.methodsOf for Enumeration fails in Scala 3 #3411

OndrejSpanel opened this issue Feb 25, 2024 · 1 comment
Labels

Comments

@OndrejSpanel
Copy link
Contributor

OndrejSpanel commented Feb 25, 2024

Another one discovered thanks to using the workaround suggested in #3367. Tested with Scala 3.4.1-RC1 and surface 24.2.2, works fine in Scala 2:

build.sbt:

version := "0.1.0-SNAPSHOT"

scalaVersion := "3.4.1-RC1"

name := "airframe-surface-test"

libraryDependencies += "org.wvlet.airframe" %% "airframe-surface" % "24.2.2"

Main.scala:

import wvlet.airframe.surface.Surface

object Main {

  object ScalaEnum extends Enumeration {
    val EnumA, EnumB = Value

    type ScalaEnum = Value
  }

  def main(args: Array[String]): Unit = {
    Surface.methodsOf[ScalaEnum.ScalaEnum]
  }
}

produces following error:

C:\Dev\airframe-surface-test\src\main\scala\Main.scala:12:22
constructor ValueSet cannot be accessed as a member of Enumeration.this.ValueSet from object Main.
  private[ValueSet] constructor ValueSet can only be accessed from class ValueSet in class Enumeration.
    Surface.methodsOf[ScalaEnum.ScalaEnum]

@OndrejSpanel OndrejSpanel changed the title Surface.methodsOf for Enumeration fails in Scala 3 Surface.methodsOf for Enumeration fails in Scala 3 Feb 25, 2024
@xerial xerial added the bug label Feb 27, 2024
@OndrejSpanel
Copy link
Contributor Author

I guess with #3423 the behaviour will change, as private[ValueSet] should be handled gracefully. It might be worth checking what is the current behaviour with Scala 2 and make sure with Scala 3 it behaves the same way.

OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 28, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 29, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 29, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Feb 29, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Mar 12, 2024
OndrejSpanel added a commit to OndrejSpanel/airframe that referenced this issue Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants