scala / scala3-example-project Goto Github PK
View Code? Open in Web Editor NEWAn example sbt project that compiles using Dotty
License: Creative Commons Zero v1.0 Universal
An example sbt project that compiles using Dotty
License: Creative Commons Zero v1.0 Universal
Same as in scala/vscode-scala-syntax#170
I'm getting the following error message. By the way same error with sbt new lampepfl/dotty.g8
and sbt new lampepfl/dotty-cross.g8
.
warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/org/brianmckenna/wartremover_0.1/0.12/wartremover_0.1-0.12.pom
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.brianmckenna#wartremover_0.1;0.12: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.brianmckenna:wartremover_0.1:0.12 ((sbt.BuildExtra) Defaults.scala#L2018)
[warn] +- dotty-example-project:dotty-example-project_0.1:0.1
sbt.ResolveException: unresolved dependency: org.brianmckenna#wartremover_0.1;0.12: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:128)
at sbt.IvySbt.withIvy(Ivy.scala:125)
at sbt.IvySbt$Module.withModule(Ivy.scala:156)
at sbt.IvyActions$.updateEither(IvyActions.scala:168)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1488)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1484)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1519)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1517)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1522)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1516)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1539)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1466)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1418)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.brianmckenna#wartremover_0.1;0.12: not found
This section described how to use normal dependencies published for Scala 2.
I think it would be great if the section also mention regarding sbt plugin, for people like me who lack of in-depth understadning sbt.
When I updated my project/plugins.sbt
like below:
def dottySupport(moduleId: ModuleID): ModuleID = moduleId.withDottyCompat(scalaVersion.value)
addSbtPlugin(dottySupport("org.scala-js" % "sbt-scalajs" % "0.6.31"))
addSbtPlugin(dottySupport("org.scalameta" % "sbt-scalafmt" % "2.3.0"))
error: value withDottyCompat is not a member of sbt.ModuleID
occured.
sbt compile
in this project fails with the following error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.lihaoyi#ammonite_0.1-SNAPSHOT;0.7.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
when I have the following in ~/.sbt/0.13/global.sbt
:
libraryDependencies += "com.lihaoyi" % "ammonite" % "0.7.0" % "test" cross CrossVersion.full
It seems like the cross CrossVersion.full
generates an invalid version in this case because there is no published SNAPSHOT version of ammonite?
I'm not sure if this is a bug or more of a pitfall to document. I'd be happy to make a PR adding warnings in the README
if its a documentation issue.
Hi everyone.
This project include example to use lazy val
field. In new proposal to Scala project have changed implementation of lazy val
.
/**
* In order to get thread safety, you need to put @volatile before lazy vals.
* https://dotty.epfl.ch/docs/reference/changed-features/lazy-vals-init.html
*/
@volatile lazy val xs: List[String] = List("d", "o", "t", "t", "y")
As I understood to safe thread-safe sematics we need to attach @volatile annotation to lazy val
field.
Dotty/Scala3 in std have scala.annotation.threadUnsafe
annotation also. Is it still actual annotation? And if it is true in wich cases we need to use this annotation. Can you please add example?
Thank you
I have very simple sbt project and can't get it run. What can I do? What am I doing wrong?
sbt version is 1.4.4
This is build.sbt
val dottyVersion = "3.0.0-M2"
lazy val root = project
.in(file("."))
.settings(
name := "dotty-simple",
version := "0.1.0",
scalaVersion := dottyVersion
)
sbt outputs the following:
/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Didea.managed=true -Dfile.encoding=UTF-8 -jar /home/snet/.local/share/JetBrains/IntelliJIdea2020.3/Scala/launcher/sbt-launch.jar
[info] welcome to sbt 1.4.4 (Ubuntu Java 11.0.9.1)
[info] loading global plugins from /home/snet/.sbt/1.0/plugins
[info] loading settings for project dotty-workaround-build from plugins.sbt ...
[info] loading project definition from /home/snet/Documents/razvoj/dotty-workaround/project
[info] loading settings for project root from build.sbt,project\plugins.sbt ...
[info] set current project to dotty-simple (in build file:/home/snet/Documents/razvoj/dotty-workaround/)
[info] sbt server started at local:///home/snet/.sbt/1.0/server/026a91eb7bb819c87101/sock
[info] started sbt server
sbt:dotty-simple>
;set _root_.scala.collection.Seq(historyPath := None,shellPrompt := { _ => "" },SettingKey[_root_.scala.Option[_root_.sbt.File]]("sbtStructureOutputFile")
in _root_.sbt.Global := _root_.scala.Some(_root_.sbt.file("/tmp/sbt-structure.xml")),SettingKey[_root_.java.lang.String]("sbtStructureOptions")
in _root_.sbt.Global := "download, resolveClassifiers")
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info] Run `last` for details.
[info] Reapplying settings...
[info] set current project to dotty-simple (in build file:/home/snet/Documents/razvoj/dotty-workaround/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /home/snet/.local/share/JetBrains/IntelliJIdea2020.3/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2020.3/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] set current project to dotty-simple (in build file:/home/snet/Documents/razvoj/dotty-workaround/)
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] ch.epfl.lamp:sbt-dotty:0.4.6 (sbtVersion=1.0, scalaVersion=3.0.0-M2)
[warn]
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run 'last update' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading ch.epfl.lamp:sbt-dotty;sbtVersion=1.0;scalaVersion=3.0.0-M2:0.4.6
[error] Not found
[error] Not found
[error] not found: /home/snet/.ivy2/local/ch.epfl.lamp/sbt-dotty/scala_3.0.0-M2/sbt_1.0/0.4.6/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/ch/epfl/lamp/sbt-dotty_3.0.0-M2_1.0/0.4.6/sbt-dotty-0.4.6.pom
[error] Error downloading org.scala-lang:scala-library:3.0.0-M2
[error] Not found
[error] Not found
[error] not found: /home/snet/.ivy2/local/org.scala-lang/scala-library/3.0.0-M2/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scala-lang/scala-library/3.0.0-M2/scala-library-3.0.0-M2.pom
[error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading ch.epfl.lamp:sbt-dotty;sbtVersion=1.0;scalaVersion=3.0.0-M2:0.4.6
[error] Not found
[error] Not found
[error] not found: /home/snet/.ivy2/local/ch.epfl.lamp/sbt-dotty/scala_3.0.0-M2/sbt_1.0/0.4.6/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/ch/epfl/lamp/sbt-dotty_3.0.0-M2_1.0/0.4.6/sbt-dotty-0.4.6.pom
[error] Error downloading org.scala-lang:scala-library:3.0.0-M2
[error] Not found
[error] Not found
[error] not found: /home/snet/.ivy2/local/org.scala-lang/scala-library/3.0.0-M2/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scala-lang/scala-library/3.0.0-M2/scala-library-3.0.0-M2.pom
[error] Total time: 1 s, completed 16. dec. 2020 11:00:38
[info] shutting down sbt server
0.19.1-... is an incorrect latest build. The right latest nightly is 0.19.0-... (and tomorrow will be 0.20.0-...).
Apparently, the failure is an infrastructural issue:
Expected feature release number in range of 9 to 13, but got: 8
The command "~/bin/install-jdk.sh --target "/home/travis/oraclejdk8" --workspace "/home/travis/.cache/install-jdk" --feature "8" --license "BCL"" failed and exited with 3 during .
Looks like Travis suddenly stopped digesting the JDK installation command.
I am a bit confused what this Map
example shows here:
https://github.com/scala/scala3-example-project/blob/main/src/main/scala/TypeLambdas.scala#L6-L12
Since it works in Scala 2 also:
https://scalafiddle.io/sf/jjhjzwa/0
Sorry if I missed something.
CI told us on #46 that code adjustments will be needed
Hi, a newbie question:
if I add println(Console.YELLOW + s"Scala version = ${util.Properties.versionString}")
into Main.scala
and run sbt run
I got:
Scala version = 2.13.4
Trait Params example:
Hello Dotty!
...
Any idea why I'm getting 2.13.4 instead of Scala 3.0.0RC1? (the true is that I have installed Scala 2.13.4 on my local laptop)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.