optics-dev / Monocle

Optics library for Scala

Home Page:https://www.optics.dev/Monocle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Monocle to dotty community build

julien-truffaut opened this issue · comments

commented

I will take this.

We just merged a fix for Scala 3 RC1, it should be possible to add Monocle to the community build. Let me know if you have any problem.

commented

Hi @julien-truffaut,
I used lates master, but the coreJVM/test fails with the following

[error] -- Error: /__w/dotty/dotty/community-build/community-projects/Monocle/core/shared/src/test/scala-3.x/monocle/focus/FocusCastAsTest.scala:19:35 
[error] 19 |    val asBanana = Focus[Food](_.as[Banana])
[error]    |                               ^^^^^^^^^^^^
[error]    |            class Nothing in package scala does not take type parameters

[error] -- [E008] Not Found Error: /__w/dotty/dotty/community-build/community-projects/Monocle/core/shared/src/test/scala-3.x/monocle/focus/FocusCastAsTest.scala:24:26 
[error] 24 |    assertEquals(asBanana.getOption(foodB), Some(Banana(40, true)))
[error]    |                 ^^^^^^^^^^^^^^^^^^
[error]    |value getOption is not a member of Nothing, but could be made available as an extension method.
[error]    |
[error]    |The following import might make progress towards fixing the problem:
[error]    |
[error]    |  import munit.Clue.generate
[error]    |

[error] -- [E008] Not Found Error: /__w/dotty/dotty/community-build/community-projects/Monocle/core/shared/src/test/scala-3.x/monocle/focus/FocusCastAsTest.scala:25:26 
[error] 25 |    assertEquals(asBanana.getOption(foodA), None)
[error]    |                 ^^^^^^^^^^^^^^^^^^
[error]    |value getOption is not a member of Nothing, but could be made available as an extension method.
[error]    |
[error]    |The following import might make progress towards fixing the problem:
[error]    |
[error]    |  import munit.Clue.generate
[error]    |

[error] -- Error: /__w/dotty/dotty/community-build/community-projects/Monocle/core/shared/src/test/scala-3.x/monocle/focus/FocusCastAsTest.scala:29:56 
[error] 29 |    val mealAppleColor = Focus[Meal](_.mainIngredient.as[Apple].color)
[error]    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |            class Nothing in package scala does not take type parameters

[error] -- Error: /__w/dotty/dotty/community-build/community-projects/Monocle/core/shared/src/test/scala-3.x/monocle/focus/FocusCastAsTest.scala:40:37 
[error] 40 |    val getMystery = Focus[Food](_.as[MysteryFood[String]].mystery) 
[error]    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |            class Nothing in package scala does not take type parameters

[error] 5 errors found
[error] 5 errors found
[error] (coreJVM / Test / compileIncremental) Compilation failed
[error] Total time: 23 s, completed Mar 7, 2021 9:14:52 PM

relevant Pull Request: scala/scala3#11468

It looks like the as feature in Focus is broken in the latest dotty version.

Hey @dotbg, how can I reproduce this? Do you know what Dotty version this test ran against?

commented

@kenbot it is latest dotty master (Scala version to 3.0.0-RC2-bin-SNAPSHOT).
Perhaps, it is easier to use the dotbg:added-monocle branch.

The dotty failure suggests the following steps:

sbt community-build/prepareCommunityBuild
cd community-build/community-projects/Monocle
sbt -sbt-version 1.4.7 -Dsbt.supershell=false -Ddotty.communitybuild.dir=/__w/dotty/dotty/community-build --addPluginSbtFile=$DOTTY_PATH/community-build/sbt-dotty-sbt "set testOptions in Global += Tests.Argument(TestFramework("munit.Framework"), "+l"); clean; set logLevel in Global := Level.Error; set updateOptions in Global ~= (_.withLatestSnapshots(false)); set scalacOptions in Global ++= List("-Ycheck-init");++3.0.0-RC2-bin-SNAPSHOT!; coreJVM/test"

note: /__w/dotty/dotty is the checkout directory location.

running the

git submodule update --init

may be required as well

I just ran the monocle test from the CommunityBuildTestA

The branch should be up to date now

Surprisingly, build is green for RC2 #1132

commented

I have updated my PR

commented

It was approved. I expect it to be merged soon scala/scala3#11468

commented

merged scala/scala3#11468

@julien-truffaut could you, please, close this issue. Thanks in advance.