Skip to content

Surface.methodsOf for Enumeration fails in Scala 3 #3411

@OndrejSpanel

Description

@OndrejSpanel

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions