scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.87k stars 1.06k forks source link

Implicit not being imported #11798

Closed japgolly closed 3 years ago

japgolly commented 3 years ago

Compiler version

3.0.0-RC1

stdlibExtJVM> show Test / scalacOptions
[info] * -deprecation
[info] * -unchecked
[info] * -feature
[info] * -language:postfixOps
[info] * -language:implicitConversions
[info] * -language:higherKinds
[info] * -language:existentials
[info] * -source:3.0-migration
[info] * -Ykind-projector

Minimized code

Here I'm importing my TestUtil._ but TestUtil.scalazEqualFromUnivEq isn't importing:

import japgolly.microlibs.testutil.TestUtil._

val x = japgolly.microlibs.testutil.TestUtil.scalazEqualFromUnivEq[Int] // ok
val y = scalazEqualFromUnivEq[Int] // error

Output

[error] 8 |val y = scalazEqualFromUnivEq[Int]
[error]   |        ^^^^^^^^^^^^^^^^^^^^^
[error]   |        Not found: scalazEqualFromUnivEq

Expectation

It should compile.

Reproduction

cd /tmp
git clone https://github.com/japgolly/microlibs-scala.git
cd microlibs-scala
git checkout bug/import
sbt stdlibExtJVM/test:compile
nicolasstucki commented 3 years ago

This was probably fixed in #11591

japgolly commented 3 years ago

The problem still persists with Scala 3.0.0-RC2-bin-20210317-758782a-NIGHTLY so #11591 doesn't seem to have fixed this.

nicolasstucki commented 3 years ago

@japgolly could you minimize it?

julienrf commented 3 years ago

Shouldn’t you import japgolly.microlibs.testutil.TestUtil.given?

japgolly commented 3 years ago

@julienrf Shouldn't have to with -source:3.0-migration. I'm trying to cross-compile code for Scala 2 and Scala 3.

smarter commented 3 years ago

Are you sure this is supposed to work? When I grep for scalazEqualFromUnivEq in the branch you linked to I get:

test-util/shared/src/main/scala/japgolly/microlibs/testutil/TestUtil.scala
4:import japgolly.univeq.UnivEqScalaz.scalazEqualFromUnivEq

stdlib-ext/shared/src/test/scala/japgolly/microlibs/stdlib_ext/ExtractorsTest.scala
7:val x = japgolly.microlibs.testutil.TestUtil.scalazEqualFromUnivEq[Int]
8:val y = scalazEqualFromUnivEq[Int]

So TestUtil isn't defining scalazEqualFromUnivEq.

japgolly commented 3 years ago

Ah I'm so sorry for dropping the ball on this one. I raised over 100 tickets at that time and this one dropped through my fingers. I'll get back on this next week.

japgolly commented 3 years ago

Tried again with 3.0.0 final and this works now

som-snytt commented 3 years ago

I was going to comment yesterday that I also tried the example project successfully. I didn't get around to clarifying anything because I was lost in the gollyverse, which is bigger on the inside than it looks from without.

To pick up the ball metaphor, the previous discussion is like golf when one goes missing.