scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

https://github.com/Bersier/physical requires `sbt clean compile` - fails to compile without the clean.

Open dwalend opened this issue 3 years ago • 3 comments

Compiler version

3.1.3

Minimized code

It's four files and a build.sbt - not very minimized, but several of us have been able to reproduce it. (If you can wait two weeks when I get a bit of free time I'd be happy to see if I can bracket the behavior. I think reporting this early is best.)

Start with https://github.com/Bersier/physical

Output (click arrow to expand)

sbt compile will finish in maybe 10 seconds, works great, everything compiles. Successive sbt clean compile calls work fine.

Make any change - maybe rename something - to Dimensions.scala .(Another person on Scala Users reported problems when adding just a blank line.)

sbt compile now takes so long that it seems like an infinite loop. It finishes after perhaps 10 minutes, failing to compile with a lot of excuses despite no interesting changes to the code.

I don't believe the problem is the opaque type in Dimensions because I replaced it with a value class and got the same effect.

dwalend avatar Jul 21 '22 22:07 dwalend

The project seems to fail compilation with match type reduction errors on the 3.2.0-RCs and latest nightly, so that may need to be addressed first.

griggt avatar Jul 21 '22 23:07 griggt

On 3.2.0-RC2, it fails with

[error] -- [E007] Type Mismatch Error: /.../src/main/scala/types/AdditionalUnits.scala:9:38
...

But compiles on 3.1.3. Therefore, I mark it as a regression. Please note that there are two issues:

  • A long compilation that is reported by @dwalend
  • Regression with failing compilation

szymon-rd avatar Jul 22 '22 09:07 szymon-rd

@dwalend It would be very helpful if you could provide minimization in a free moment.

szymon-rd avatar Jul 22 '22 14:07 szymon-rd

The code has grown since this has been reported. Here is a link to the code as it was back then. Frustratingly, I cannot even reproduce the issue at this time because of another bug:

sbt thinks that server is already booting because of this exception:
sbt.internal.ServerAlreadyBootingException: java.io.IOException: org.scalasbt.ipcsocket.NativeErrorException: [95] Operation not supported

Bersier avatar Aug 18 '22 13:08 Bersier

I filed this ticket about the regression (assuming it is the only one).

Bersier avatar Aug 27 '22 15:08 Bersier

I was able to (finally) commit some time, and can report some updates:

The part of the problem where the compiler runs for an absurdly long time seems gone in Scala 3.3.0.

The part of the problem where it needs an sbt clean test to compile remains. I was able to bracket things a little bit.

With 3 (or 2) dimensions - just Length, Time, and Temperature - things work fine consistently without the clean.

With 4 or more dimensions - Length, Time, Temperature, and Mass - the bug appears.

Procedure is sbt clean test , rename ceil to ceilNoClean in Dimensions.scala , sbt test . With 4 or more dimensions the second compile fails with

[error] -- [E007] Type Mismatch Error: /Users/dwalend/projects/physical/src/main/scala/dimensional/additionalunits/additionalUnits.scala:13:45 
[error] 13 |val electronVolt: Energy = 1.602176634e-19 * joule
[error]    |                                             ^^^^^
[error]    |                            Found:    (y$proxy5 :
[error]    |                              (dimensional.dimension.Dimensions.joule :
[error]    |                                dimensional.dimension.Dimensions.Energy)
[error]    |                             & $proxy10.Energy)
[error]    |                            Required: Double
...

as a first error.

If you'd like to use my fork for bracketing and testing, start with my fork's branches:

  • https://github.com/dwalend/physical/tree/worksWith3Dimensions - works fine
  • https://github.com/dwalend/physical/tree/brokenWith4Dimensions - shows the bug

dwalend avatar Jun 05 '23 21:06 dwalend

I was able to (finally) commit some time, and can report some updates:

The part of the problem where the compiler runs for an absurdly long time seems gone in Scala 3.3.0.

The part of the problem where it needs an sbt clean test to compile remains. I was able to bracket things a little bit.

With 3 (or 2) dimensions - just Length, Time, and Temperature - things work fine consistently without the clean.

With 4 or more dimensions - Length, Time, Temperature, and Mass - the bug appears.

Procedure is sbt clean test , rename ceil to ceilNoClean in Dimensions.scala , sbt test . With 4 or more dimensions the second compile fails with

[error] -- [E007] Type Mismatch Error: /Users/dwalend/projects/physical/src/main/scala/dimensional/additionalunits/additionalUnits.scala:13:45 
[error] 13 |val electronVolt: Energy = 1.602176634e-19 * joule
[error]    |                                             ^^^^^
[error]    |                            Found:    (y$proxy5 :
[error]    |                              (dimensional.dimension.Dimensions.joule :
[error]    |                                dimensional.dimension.Dimensions.Energy)
[error]    |                             & $proxy10.Energy)
[error]    |                            Required: Double
...

as a first error.

If you'd like to use my fork for bracketing and testing, start with my fork's branches:

  • https://github.com/dwalend/physical/tree/worksWith3Dimensions - works fine
  • https://github.com/dwalend/physical/tree/brokenWith4Dimensions - shows the bug

On the latest version of the compiler:

sven@bot:~/physical$ sbt clean test
[info] welcome to sbt 1.7.1 (Ubuntu Java 11.0.19)
[info] loading global plugins from /home/sven/.sbt/1.0/plugins/project
[info] loading global plugins from /home/sven/.sbt/1.0/plugins
[info] loading project definition from /home/sven/physical/project
[info] loading settings for project root from build.sbt ...
[info] set current project to physical (in build file:/home/sven/physical/)
[success] Total time: 0 s, completed Jun 6, 2023, 4:49:09 PM
[info] compiling 14 Scala sources to /home/sven/physical/target/scala-3.3.2-RC1-bin-SNAPSHOT/classes ...
[success] Total time: 9 s, completed Jun 6, 2023, 4:49:18 PM
sven@bot:~/physical$ sbt test
[info] welcome to sbt 1.7.1 (Ubuntu Java 11.0.19)
[info] loading global plugins from /home/sven/.sbt/1.0/plugins/project
[info] loading global plugins from /home/sven/.sbt/1.0/plugins
[info] loading project definition from /home/sven/physical/project
[info] loading settings for project root from build.sbt ...
[info] set current project to physical (in build file:/home/sven/physical/)
[success] Total time: 1 s, completed Jun 6, 2023, 4:49:45 PM

And the regression was just fixed by #17180.

Decel avatar Jun 06 '23 14:06 Decel

Fixed with #17180

dwijnand avatar Jun 06 '23 21:06 dwijnand

Thanks!

dwalend avatar Jun 07 '23 19:06 dwalend