scalascala-3opaque-types

Is it possible to export top level Opaque Types in Scala 3?


I am playing with the Scala 3 feature Export Clauses.

Everything works, except of opaque types.

I could not find any restrictions on them. My Opaque Type:

opaque type BpmnPath = String

object BpmnPath:
  def apply(path: String): BpmnPath = path

My exports:

package camundala

export model.BpmnPath

Usage:

package camundala
package dsl

trait DSL :

  def path(pathStr: String): BpmnPath =
    BpmnPath(pathStr)

This gives me the following exception:

Found:    camundala.model.exports$package.BpmnPath
Required: camundala.BpmnPath²

where:    BpmnPath  is a type in package object exports$package
          BpmnPath² is a type in package object exports$package which is an alias of camundala.model.BpmnPath


Solution

  • I asked this question on the Scala Contributor Forum.

    Turns out that this is a bug that is fixed with 3.0.1-RC1.