Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore incompatible NIR files instead of crashing #3881

Closed
WojciechMazur opened this issue Apr 17, 2024 · 0 comments · Fixed by #3930
Closed

Ignore incompatible NIR files instead of crashing #3881

WojciechMazur opened this issue Apr 17, 2024 · 0 comments · Fixed by #3930

Comments

@WojciechMazur
Copy link
Contributor

Related to munit 1.0.0-M11 release - lampepfl/gears#64 (comment) - in this release probably some garbage file generated using 0.4.x where packaged together with NIR files generated for 0.5.x.
The one identified file that could have contained old version of NIR was from Reflectively Instantiated class - in the 0.5.x the symbol names of them are fixed, previously they were create non-standard name partially based on mangle name of the owner class. Because build tool does not clean the target/scala-X/classes directory this single file could have survived the compilation after upgrade to 0.5.0 without override as there would be no file generated with that name in 0.5.x.

Even though this issue was related to contamination of release build for munit, we should be able to prepare toolchain for this kind of issues. We should ignore NIR files that have incompatible format, instead of crashing build using exception. Probably this file was only read when scanning for NIR files to gather required information and it would not be used when class loading.

Steps to reproduce:

  1. git clone https://github.com/scalameta/munit -b v1.0.0-M1
  2. sbt +munitNative/compile
  3. Update version of Scala Native plugin from 0.4.x to 0.5.0
  4. sbt +munitNative/publishLocal
  5. Try to compile using scala-cli
//> using dep org.scalameta::munit::1.0.0-M11+<data-specific-part>-SNAPSHOT

class MyTests extends munit.FunSuite {
  test("foo") {
    assert(2 + 2 == 4)
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant