bug icon indicating copy to clipboard operation
bug copied to clipboard

Can't use nightly build of dotty as a runtime dependency from 2.13.8

Open adampauls opened this issue 2 years ago • 5 comments

reproduction steps

Include a nightly build of dotty as a runtime dependency using "org.scala-lang" %% "scala3-compiler" % "3.1.3-RC1-bin-20220221-3ca087c-NIGHTLY".

In a program run with Scala 2.13.8.

problem

I get this error message

[error] TASTy signature has wrong version.
[error]  expected: {majorVersion: 28, minorVersion: 1}
[error]  found   : {majorVersion: 28, minorVersion: 2 [unstable release: 1]}

I think this is probably intended behavior, but it would be nice if there were a way to work around it to experiment with nightlies.

adampauls avatar Feb 26 '22 00:02 adampauls

@bishabosha is this expected?

SethTisue avatar Feb 26 '22 01:02 SethTisue

Dale notes that there is doc at https://github.com/lampepfl/dotty/blob/main/tasty/src/dotty/tools/tasty/TastyFormat.scala#L311-L344

One thing it says is:

A compiler with a stable TASTy version can never read a file with an unstable TASTy version

Whoever wrote that probably wasn't even thinking about Scala 2 at all, but arguably this is working as designed.

I suppose one could argue that Scala 2 nightlies ought to be able to read unstable TASTy, and we ought to only disable that in our actual releases. But in Scala 2, we don't currently have any code which distinguishes release builds from nightly builds, so there isn't an existing switch we can flip here, and I'm not sure there's sufficient motivation here to introduce one.

I'd suggest building your own Scala 2 locally and disabling the check. But I'm not positive that I would oppose introducing a trapdoor. I'm curious what this is really about, what is your true goal here...?

SethTisue avatar Mar 02 '22 17:03 SethTisue

It's a bit of a long story, but basically we really just want a version of Scala meta that is error-tolerant like dotty's Parser is (so we can use it for autocomplete and such). Since that doesn't exist, we decided to actually just use dotty. This works fine on a stable version, but I wanted to test out a few bug fixes before 3.1.3 or 3.2.0 come out. I did manage to build the non-bootstrapped version of dotty locally and test everything out, but I was hoping to be able to depend on a nightly for a little while without having to do the dance.

I can totally understand not wanting to fix this issue since my use here is very off-label, I was just hoping there was a backdoor. I don't see much downside to a -Ytasty-reader -Yunstable-tasty option, but it's more work than nothing, so I can't complain too much!

adampauls avatar Mar 04 '22 23:03 adampauls

ping @bishabosha

SethTisue avatar Mar 21 '22 16:03 SethTisue

Hey, so yes it is the intended behaviour that Scala 2 compiler should only be able to read the latest stable release it knows about, but I'll be happy to add a flag that disables the check under a flag - users would have to be aware to never use this flag to depend on something if they intend to publish a library

bishabosha avatar Apr 01 '22 08:04 bishabosha