0.4.3-RC1 (2022-01-04)¶
We’re happy to announce the release of Scala Native v0.4.3-RC1, which brings support for Scala 3. This release does also contain performance-critical bug fixes to performing operations on Strings, leading to significant improvement of regexes throughput.
Due to multiple internal changes and to ensure compatibility with libraries published using Scala 2.13, we’ve decided that the 0.4.3 will be preceded by release candidates. If no new bugs will be discovered until 17th January 2022 it would be promoted to a full release.
Breaking changes¶
The minimal version of Scala 3 supported by Scala Native is 3.1.0, due to fatal blockers in Scala 3.0.x.
Changes to the main method resolving¶
In the previous versions of Scala Native main entry point was always resolved based on the companion object defining the main method.
This behaviour however lead to multiple issues in situations when an actual main method was introduced via inheritance. Because of that issue,
build tools needed to always add $
suffix to actual main class to make sure that entry method would be found.
With the 0.4.3 release, Scala Native does generate static method forwarders in the same way as it is done in JVM and Scala.js.
Build tools should make sure to no longer add $
to the discovered main class name.
Source compatibity of stackalloc[T]
and alloc[T]
methods¶
No-param methods scalanative.unsafe.stackalloc[T]
and scalanative.unsafe.alloc[T]
were removed from Scala 3 unsafe
package.
In Scala 2 these methods have been deprecated and it is recommended to use empty-param variants of these methods instead, eg. scalanative.unsafe.stackalloc[T]()
.
This change was introduced due to changes of how does Scala 3 interpret source code as it could lead to dangerous, hard to debug, runtime errors.
As an example call to stackalloc[Byte](10)
in Scala 2 would result in allocating memory of size 10 * sizeof(Byte)
. In Scala 3 however,
the given snippet would be interpreted as stackalloc[Byte].apply(10)
which is still valid, but leads to allocating 1 * sizeof(Byte)
chunk of memory and
accessing its 10th element, which would lead to undefined behaviour.
More information can be found in #2480
Known issues¶
Cannot create documentation using scaladoc in Scala Native sbt project¶
When trying to generate documentation using Scaladoc for projects using Scala Native compilation would fail with an exception.
This issue is common for most of the compiler plugins and was already fixed in Scala 3.1.1-RC2 compiler. As a workaround in Scala 3.1.0 we would recomend adjusting sbt build, by filtering out all -Xplugin
settings from Compile / doc / scalacOptions
.
Commits since last release | 40 |
Merged PRs | 40 |
Contributors | 5 |
Contributors¶
Big thanks to everybody who contributed to this release or reported an issue!
$ git shortlog -sn --no-merges v0.4.2..v0.4.3-RC1
34 Wojciech Mazur
3 Eric K Richardson
1 Anton Sviridov
1 Jan Chyb
1 Lorenzo Gabriele
Merged PRs¶
v0.4.3-RC1 (2022-01-04)¶
Merged pull requests:
Bug fixes¶
Fix certain absolute file paths being shown as relative on Windows #2471 (jchyb)
Make
java.nio.MappedByteBuffer
JDK9+ compliant #2453 (WojciechMazur)Remove redundant coversion of
CharSequence
intoArray
inCharacter.codePoint{at, before}
methods #2495 (WojciechMazur)
Features¶
System.properties define
os.arch
#2452 (WojciechMazur)Allow to define top-level extern definitons in Scala 3 #2496 (WojciechMazur)
Native library¶
Adapt
unsafe
package for upcoming Scala 3 support #2454 (WojciechMazur)Enforce usage of empty parens variant of
stackalloc[T]
andalloc[T]
in Scala 3 #2480 (WojciechMazur)
Compiler plugin / NIR¶
Use encoded names for methods and fields in NIR #2458 (WojciechMazur) (WojciechMazur)
Define
Field
operation in NIR #2460 (WojciechMazur)Port NIR generation compiler plugin to Scala 3 #2462 (WojciechMazur)
Adapt LazyVals to work in Scala Native #2465 (WojciechMazur)
Port JUnit Plugin to Scala 3 #2467 (WojciechMazur)
Introduce static scope and generate static method forwarders in Scala 3 #2472 (WojciechMazur)
Generate static method forwarders in Scala 2 #2476 (WojciechMazur)
Use public static main method forwarder as entry point #2481 (WojciechMazur)
Improvements to generation and invocation of static methods #2489 (WojciechMazur)
Linker¶
Make reachablity phase more user friendly #2469 (WojciechMazur)