加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – 找不到路径依赖类型的值

发布时间:2020-12-16 10:04:42 所属栏目:安全 来源:网络整理
导读:也许我需要复习依赖类型,但我不明白为什么以下不起作用: trait Code { type In; type Out }trait Handler[In,Out]class Foo(val code: Code)(handler: Option[Handler[code.In,code.Out]]) 错误: console:52: error: not found: value code class Foo(val
也许我需要复习依赖类型,但我不明白为什么以下不起作用:

trait Code { type In; type Out }

trait Handler[In,Out]

class Foo(val code: Code)(handler: Option[Handler[code.In,code.Out]])

错误:

<console>:52: error: not found: value code
       class Foo(val code: Code)(handler: Option[Handler[code.In,code.Out]])
                                                         ^
<console>:52: error: not found: value code
       class Foo(val code: Code)(handler: Option[Handler[code.In,code.Out]])
                                                                  ^

编辑:我现在可以看到如何解决这个问题.我仍然想知道为什么以上不起作用?

解决方法

另一种解决方法:

trait Foo {
  val code: Code
  val handler: Handler[code.In,code.Out] 
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读