Scala 3: wrongly accepted `modify` does nothing
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
该 issue 未指定源文件或测试;首先在 Scala 3 下编译提供的 Main 示例,并将其行为与 Scala 2 进行比较。跟踪 modify(_.c) 入口点以及 copy 参数的处理。完成标准是 Scala 3 拒绝此案例,并且有一个回归测试覆盖它。
由索引模型根据 Issue 内容生成。
描述
Following code does not compile in Scala 2 and it should not compile in Scala 3. It is accepted instead, but the modify does nothing at all:
import com.softwaremill.quicklens._
object Main {
case class Content(x: String)
class A(val c: Content) {
override def toString = s"x:${c.x}"
def copy(x: String = c.x): A = new A(Content(x))
}
def main(args: Array[String]): Unit = {
val a = new A(Content("A"))
val am = a.modify(_.c).setTo(Content("B"))
println(am)
}
}
There is no copy accepting c parameter, therefore modify(_.c) is impossible to implement.
Result when running this in Scala 3 is:
x:A
- 主要语言
- Scala
- 星标
- 852
- 派生
- 53
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
softwaremill/quicklens 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
softwaremill/quicklens#296 ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
softwaremill/quicklens#291 · 1 条评论 ·
维护者通常 2 天内回复
-
Cannot use modify in opaque types可能重新可做 @KacperFKorban 于 855 天前认领,目前没有进行中的 PR。 未关闭
softwaremill/quicklens#234 · 2 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
softwaremill/quicklens#208 · 2 条评论 ·
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
softwaremill/quicklens#116 · 1 条评论 ·
维护者通常 2 天内回复
查看 softwaremill/quicklens 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
propensive/soundness#2351 ·
维护者通常 1 天内回复
-
Traffic event delivered/rejected counters appear swapped in TrafficStateController.updateWithReceipt未关闭
难度 2/5 1-3 小时 新手友好度 65/100
digital-asset/canton#705 ·
维护者通常 2 天内回复
-
easy first-contributor first-contributors good first issue help wanted scala up-for-grabs
难度 2/5 1-3 小时 新手友好度 88/100
fork-commit-merge/fork-commit-merge#8457 ·
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 78/100
promovolve/promovolve#358 ·
维护者通常 1 天内回复