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

I asked this question on Stackoverflow and got no answer. Here it is:

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

Original Question on Stackoverflow

Hi, this looks just like the bug `export` of opaque type alias from another package leads to type mismatch · Issue #12168 · lampepfl/dotty · GitHub which was fixed in Scala 3.0.1-RC1, would you be able to try again with that?

Thanks @bishabosha, 3.0.1-RC1 solves that problem - but I have now a new compilation problem:

export org.camunda.bpm.model.bpmn.{instance as cBpmnInstance}

Gives me:

no eligible member instance at org.camunda.bpm.model.bpmn
export org.camunda.bpm.model.bpmn.{instance as cBpmnInstance}

I get this for any package.

would you be able to open an issue at GitHub - lampepfl/dotty: The Scala 3 compiler, also known as Dotty. with all the minimum code required to reproduce the error?

Looks like for renaming there is a restriction:

Restrictions:

3. Simple renaming exports like

export status as stat

are not supported yet. They would run afoul of the restriction that the exported a cannot be already a member of the object containing the export. This restriction might be lifted in the future.

Interesting that this works with 3.0.0.

Or is this another case?