【问题标题】:Is it possible to export top level Opaque Types in Scala 3?是否可以在 Scala 3 中导出顶级不透明类型?
【发布时间】:2021-08-29 15:50:38
【问题描述】:

我正在使用 Scala 3 功能 Export Clauses

一切正常,除了不透明类型

我找不到对它们的任何限制。 我的不透明类型:

opaque type BpmnPath = String

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

我的出口:

package camundala

export model.BpmnPath

用法:

package camundala
package dsl

trait DSL :

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

这给了我以下例外:

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

【问题讨论】:

    标签: scala scala-3 opaque-types


    【解决方案1】:

    我在Scala Contributor Forum上问了这个问题。

    原来这是一个用3.0.1-RC1 修复的错误。

    【讨论】:

      猜你喜欢
      • 2022-09-30
      • 2018-09-13
      • 1970-01-01
      • 2021-10-25
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 2010-10-03
      • 2011-09-10
      相关资源
      最近更新 更多