Comments (9)
There are a couple of things that need to be done:
- The exercises should be updated to work with Scala 3
- The test generators should be updated to work with Scala 3 and output Scala 3 code
- The docs should be updated
- The scala test-runner needs to support Scala 3
from scala.
I'm guessing this a work in progress?
I downloaded isogram
via CLI and the build.sbt
was set to scalaVersion := "2.12.8"
. The Metals extension in vscode reported that 2.12.8 may not work in future versions of Metals and that Scala should be updated to at least 2.12.12. I jumped through some hoops, some of them probably unnecessary, and after being prompted to download/import a couple files the build.sbt
was set to scalaVersion := "2.12.14"
.
I then looked at several previously downloaded Scala exercises and they all had scalaVersion := "2.12.14"
already.
Just to inform you that updating the Scala version is appreciated and, at least for the vscode Metals extension, somewhat needed.
from scala.
Ideally, we'd upgrade to Scala 3 as that should give us a bit of a performance bump that might actually get the test runner to run within the allotted time. I have no idea how hard it would be to upgrade to Scala 3 though.
from scala.
Should be pretty easy to update the exercises to work with Scala 3. Just need to update the version numbers in the build.sbt file, and the imports in the test files. Also you need to use sbt version 1.5.x +.
I wrote a blog about it (including some tips for working with IntelliJ) at http://luigip.atwebpages.com/?p=275
This is the script I run to do the above conversions (I don't think the build.properties bit is actually relevant to the downloads but it's something I ran into where it was set by IntelliJ if I tried to import the module before running sbt from the terminal first).
It works in 95% of cases but there are a few odd cases where there are imports of Scalaz or I think the one involving an optics library, that need a bit of manual intervention. Also I remember 1 case where a test used procedure syntax (def xyz {}
) which is now deprecated.
#!/usr/bin/env bash
# Check we're in a valid directory
if [[ $PWD =~ xercism/scala/.+ ]] ; then
echo "directory OK"
else
echo "invalid directory"; exit 1
fi
# build.sbt: Replace scala and scalatest versions
perl -i -0pe 's/scalaVersion :=.*/scalaVersion := "3.0.1"/' build.sbt
perl -i -0pe 's/"scalatest" % "[^"]*"/"scalatest" % "3.2.9"/' build.sbt
# build.properties (if supplied): Replace sbt version
if [[ -a project/build.properties ]] ; then
perl -i -0pe 's/sbt\.version=.*/sbt.version=1.5.5/' project/build.properties
echo build.properties updated
fi
# test source: Change scalatest imports
filename=$(find src/test/scala/*.scala |head -1)
## FunSuite
perl -i -0pe 's/import org.scalatest.{Matchers, FunSuite}/import org.scalatest.funsuite.AnyFunSuite\nimport org.scalatest.matchers.should.Matchers/' "$filename"
perl -i -0pe 's/import org.scalatest.{FunSuite, Matchers}/import org.scalatest.funsuite.AnyFunSuite\nimport org.scalatest.matchers.should.Matchers/' "$filename"
perl -i -0pe 's/extends FunSuite/extends AnyFunSuite/' "$filename"
## FlatSpec
perl -i -0pe 's/import org.scalatest.{Matchers, FlatSpec}/import org.scalatest.flatspec.AnyFlatSpec\nimport org.scalatest.matchers.should.Matchers/' "$filename"
perl -i -0pe 's/extends FlatSpec/extends AnyFlatSpec/' "$filename"
from scala.
@luigip That sounds great! Would you be willing to submit a PR?
from scala.
I'm willing to try this.
- Exercises. Remaining compile warnings (will fix if time):
- alphametics - 1 feature, 3 deprecation warnings
- armstrong numbers - 1 deprecation warning
- binary-search-tree - 1 unreachable match warning
- forth - 1 pattern match exhaustivity warning
- grade-school - 1 deprecation warning
- lens-person - 10 deprecation warnings
- linked-list - 6 unchecked runtime types warnings
- matching-brackets - 1 pattern match exhaustivity warning
- matrix - 1 deprecation warning
- nth-prime - 2 deprecation warnings
- ocatal - 1 deprecation warning
- pangram - 1 deprecation warning
- say - 1 deprecation warning
- sgf-parsing - 1 pattern match exhaustivity warning
- simple-linked-list - 2 unchecked runtime types warnings
- spiral-matrix - 1 deprecation warning
- trinary - 1 deprecation warning
- word-count - 1 deprecation warning
- wordy - 1 pattern match exhaustivity warning
- Test Generators
- Docs
- scala test-runner project
from scala.
@LarsWestergren Thanks a ton!
from scala.
Hi, I'm planning to start the Scala track and wanted to check if there is any interest in moving forward with this ticket.
from scala.
Definitely! I see that you also posted at #734 (comment), which is great!
from scala.
Related Issues (20)
- Build Test Runner HOT 7
- Build Representer and Analyzer HOT 1
- Update status of track HOT 1
- Update status of Concept Exercises HOT 1
- Launch Tracker 🔴
- Add blurb to Concept Exercises
- Support of Scala 2.13 (or even better 3.0) HOT 2
- Extract track-specific help instructions from `config/exercise_readme.go.tmpl` HOT 1
- Extract track-specific test instructions from `config/exercise_readme.go.tmpl` HOT 2
- Build analyzer
- Build representer HOT 3
- Check docs are up to date HOT 1
- Unit tests for exercise 2 "Twofer" do not compile HOT 2
- Security Issue - .gitignore file needs updated to remove files with personal information HOT 3
- Matching Brackets funsuite errors HOT 10
- Add Code Skeleton for SpaceAge.scala HOT 1
- Darts: canonical data not pulled in HOT 1
- Saddle Points exercise example is malformated in markdown HOT 1
- Building a training set of tags for scala HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala.