Skip to content

Commit 17b2981

Browse files
author
Aggelos Biboudis
authored
Merge pull request #26 from lampepfl/dotty-0.13-mill
Release Dotty 0.13.0-RC1 for mill
2 parents 7d94355 + 77ae2f9 commit 17b2981

16 files changed

+45
-47
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Any version number that starts with `0.` is automatically recognized as Dotty,
2121
you don't need to set up anything:
2222

2323
```scala
24-
def scalaVersion = "0.12.0-RC1"
24+
def scalaVersion = "0.13.0-RC1"
2525
```
2626

2727
#### Nightly builds
2828
If the latest release of Dotty is missing a bugfix or feature you need, you may
2929
wish to use a nightly build. Look at the bottom of
30-
https://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.13/ to find the version
30+
https://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.14/ to find the version
3131
number for the latest nightly build.
3232

3333
## Getting your project to compile with Dotty

build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import mill._, scalalib._
22

33
object root extends SbtModule {
44
def millSourcePath = ammonite.ops.pwd
5-
def scalaVersion = "0.12.0-RC1"
5+
def scalaVersion = "0.13.0-RC1"
66
def publishVersion = "0.1.0"
77
}

src/main/scala/AutoParamTupling.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
/**
3-
* Automatic Tupling of Function Params: http://dotty.epfl.ch/docs/reference/auto-parameter-tupling.html
3+
* Automatic Tupling of Function Params: https://dotty.epfl.ch/docs/reference/other-new-features/auto-parameter-tupling.html
44
*/
55
object AutoParamTupling {
66

77
def test: Unit = {
88

99
/**
1010
* In order to get thread safety, you need to put @volatile before lazy vals.
11-
* http://dotty.epfl.ch/docs/reference/changed/lazy-vals.html
11+
* https://dotty.epfl.ch/docs/reference/changed-features/lazy-vals.html
1212
*/
1313
@volatile lazy val xs: List[String] = List("d", "o", "t", "t", "y")
1414

src/main/scala/ImplicitFunctions.scala renamed to src/main/scala/ContextQueries.scala

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,28 @@ import scala.concurrent.{ExecutionContext, Future}
33
import scala.util.Try
44

55
/**
6-
* Implicit Function Types:
7-
* - http://dotty.epfl.ch/docs/reference/implicit-function-types.html,
6+
* Context Queries:
7+
* - http://dotty.epfl.ch/docs/reference/contextual/query-types.html,
88
* - https://www.scala-lang.org/blog/2016/12/07/implicit-function-types.html
99
*/
10-
object ImplicitFunctions {
10+
object ContextQueries /* Formerly known as Implicit Function Types */ {
1111

1212
object context {
1313
// type alias Contextual
14-
type Contextual[T] = implicit ExecutionContext => T
14+
type Contextual[T] = given ExecutionContext => T
1515

1616
// sum is expanded to sum(x, y)(ctx)
1717
def asyncSum(x: Int, y: Int): Contextual[Future[Int]] = Future(x + y)
1818

19-
def asyncMult(x: Int, y: Int) = { implicit ctx: ExecutionContext =>
20-
Future(x * y)
21-
}
19+
def asyncMult(x: Int, y: Int) given (ctx: ExecutionContext) = Future(x * y)
2220
}
2321

2422
object parse {
2523

26-
type Parseable[T] = implicit ImplicitParams.StringParser[T] => Try[T]
24+
type Parseable[T] = given ImpliedInstances.StringParser[T] => Try[T]
2725

2826
def sumStrings(x: String, y: String): Parseable[Int] = {
29-
val parser = implicitly[ImplicitParams.StringParser[Int]]
27+
val parser = implicitly[ImpliedInstances.StringParser[Int]]
3028
val tryA = parser.parse(x)
3129
val tryB = parser.parse(y)
3230

src/main/scala/ImplicitConversion.scala renamed to src/main/scala/Conversion.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import scala.language.implicitConversions
22

33
/**
4-
* Implicit Conversions: http://dotty.epfl.ch/docs/reference/changed/implicit-conversions.html
4+
* Conversions: http://dotty.epfl.ch/docs/reference/contextual/conversions.html
55
*/
6-
object ImplicitConversion {
6+
object Conversion {
77

88
case class IntWrapper(a: Int) extends AnyVal
99
case class DoubleWrapper(b: Double) extends AnyVal
1010

11-
def convert[T, U](x: T)(implicit converter: ImplicitConverter[T, U]): U = converter(x)
11+
def convert[T, U](x: T) given (converter: Conversion[T, U]): U = converter(x)
1212

13-
implicit val IntWrapperToDoubleWrapper: ImplicitConverter[IntWrapper, DoubleWrapper] = new ImplicitConverter[IntWrapper, DoubleWrapper] {
13+
implied IntWrapperToDoubleWrapper for Conversion[IntWrapper, DoubleWrapper] = new Conversion[IntWrapper, DoubleWrapper] {
1414
override def apply(i: IntWrapper): DoubleWrapper = new DoubleWrapper(i.a.toDouble)
1515
}
1616

17-
def useConversion(implicit f: ImplicitConverter[IntWrapper, DoubleWrapper]) = {
17+
def useConversion given (f: Conversion[IntWrapper, DoubleWrapper]) = {
1818
val y: IntWrapper = new IntWrapper(4)
1919
val x: DoubleWrapper = y
2020
x

src/main/scala/EnumTypes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Enum Types: http://dotty.epfl.ch/docs/reference/adts.html
2+
* Enum Types: http://dotty.epfl.ch/docs/reference/enums/adts.html
33
*/
44
object EnumTypes {
55

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import scala.util.{Success, Try}
22

33
/**
4-
* Implicit By-Name Parameters:
5-
* - http://dotty.epfl.ch/docs/reference/implicit-by-name-parameters.html
4+
* Implied Instances:
5+
* - https://dotty.epfl.ch/docs/reference/contextual/instance-defs.html
66
*/
7-
object ImplicitParams {
7+
object ImpliedInstances {
88

99
sealed trait StringParser[A] {
1010
def parse(s: String): Try[A]
1111
}
1212

1313
object StringParser {
1414

15-
def apply[A](implicit parser: StringParser[A]): StringParser[A] = parser
15+
def apply[A] given (parser: StringParser[A]): StringParser[A] = parser
1616

1717
private def baseParser[A](f: String Try[A]): StringParser[A] = new StringParser[A] {
1818
override def parse(s: String): Try[A] = f(s)
1919
}
2020

21-
implicit val stringParser: StringParser[String] = baseParser(Success(_))
22-
implicit val intParser: StringParser[Int] = baseParser(s Try(s.toInt))
21+
implied stringParser for StringParser[String] = baseParser(Success(_))
22+
implied intParser for StringParser[Int] = baseParser(s Try(s.toInt))
2323

24-
implicit def optionParser[A](implicit parser: => StringParser[A]): StringParser[Option[A]] = new StringParser[Option[A]] {
24+
implied optionParser[A] given (parser: => StringParser[A]) for StringParser[Option[A]] = new StringParser[Option[A]] {
2525
override def parse(s: String): Try[Option[A]] = s match {
2626
case "" Success(None) // implicit parser not used.
2727
case str parser.parse(str).map(x Some(x)) // implicit parser is evaluated at here
@@ -34,6 +34,6 @@ object ImplicitParams {
3434
println(implicitly[StringParser[Option[Int]]].parse(""))
3535
println(implicitly[StringParser[Option[Int]]].parse("21a"))
3636

37-
println(implicitly[StringParser[Option[Int]]](StringParser.optionParser[Int](StringParser.intParser)).parse("42"))
37+
println(implicitly[StringParser[Option[Int]]](StringParser.optionParser[Int]).parse("42"))
3838
}
3939
}

src/main/scala/IntersectionTypes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Intersection Types: http://dotty.epfl.ch/docs/reference/intersection-types.html
2+
* Intersection Types: https://dotty.epfl.ch/docs/reference/new-types/intersection-types.html
33
*/
44
object IntersectionTypes {
55

src/main/scala/Main.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ object Main {
77

88
runExample("Enum Types")(EnumTypes.test)
99

10-
runExample("Implicit Functions")(ImplicitFunctions.test)
10+
runExample("Context Queries")(ContextQueries.test)
1111

12-
runExample("Implicit Params")(ImplicitParams.test)
12+
runExample("Implied Instances")(ImpliedInstances.test)
1313

14-
runExample("Implicit Conversion")(ImplicitConversion.test)
14+
runExample("Conversion")(Conversion.test)
1515

1616
runExample("Union Types")(UnionTypes.test)
1717

src/main/scala/MultiversalEquality.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import scala.language.strictEquality
22

33
/**
4-
* Multiversal Equality: http://dotty.epfl.ch/docs/reference/multiversal-equality.html
5-
* scala.Eq definition: https://github.com/lampepfl/dotty/blob/master/library/src/scala/Eq.scala
4+
* Multiversal Equality: https://dotty.epfl.ch/docs/reference/contextual/multiversal-equality.html
5+
* scala.Eq definition: https://github.com/lampepfl/dotty/blob/master/library/src/scala/Eql.scala
66
*/
77
object MultiversalEquality {
88

99
def test: Unit = {
1010

1111
// Values of types Int and String cannot be compared with == or !=,
12-
// unless we add a custom implicit like:
13-
implicit def eqIntString: Eq[Int, String] = Eq
12+
// unless we add the derived implied instance like:
13+
implied for Eql[Int, String] = Eql.derived
1414
println(3 == "3")
1515

1616
// By default, all numbers are comparable, because of;
17-
// implicit def eqNumber : Eq[Number, Number] = Eq
17+
// implicit def eqlNumber: Eql[Number, Number] = derived
1818
println(3 == 5.1)
1919

2020
// By default, all Sequences are comparable, because of;
21-
// implicit def eqSeq[T, U](implicit eq: Eq[T, U]): Eq[Seq[T], Seq[U]] = Eq
21+
// implicit def eqlSeq[T, U](implicit eq: Eql[T, U]): Eql[GenSeq[T], GenSeq[U]] = derived
2222
println(List(1, 2) == Vector(1, 2))
2323

2424
class A(a: Int)
@@ -27,10 +27,10 @@ object MultiversalEquality {
2727
val a = new A(4)
2828
val b = new B(4)
2929

30-
// scala.language.strictEquality is enabled, therefore we need some extra implicits
30+
// scala.language.strictEquality is enabled, therefore we need some extra implied instances
3131
// to compare instances of A and B.
32-
implicit def eqAB: Eq[A, B] = Eq
33-
implicit def eqBA: Eq[B, A] = Eq
32+
implied for Eql[A, B] = Eql.derived
33+
implied for Eql[B, A] = Eql.derived
3434

3535
println(a != b)
3636
println(b == a)

src/main/scala/NamedTypeArguments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* Named Type Arguments: http://dotty.epfl.ch/docs/reference/named-typeargs.html
3+
* Named Type Arguments: https://dotty.epfl.ch/docs/reference/other-new-features/named-typeargs.html
44
*/
55
object NamedTypeArguments {
66

src/main/scala/PatternMatching.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* Pattern Matching: http://dotty.epfl.ch/docs/reference/changed/pattern-matching.html
3+
* Pattern Matching: https://dotty.epfl.ch/docs/reference/changed-features/pattern-matching.html
44
*/
55
object PatternMatching {
66

src/main/scala/StructuralTypes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* Structural Types: http://dotty.epfl.ch/docs/reference/changed/structural-types.html
3+
* Structural Types: https://dotty.epfl.ch/docs/reference/changed-features/structural-types.html
44
*/
55
object StructuralTypes {
66

src/main/scala/TraitParams.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Trait Parameters: http://dotty.epfl.ch/docs/reference/trait-parameters.html
2+
* Trait Parameters: https://dotty.epfl.ch/docs/reference/other-new-features/trait-parameters.html
33
*/
44
object TraitParams {
55

src/main/scala/TypeLambdas.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Type Lambdas: http://dotty.epfl.ch/docs/reference/type-lambdas.html
2+
* Type Lambdas: https://dotty.epfl.ch/docs/reference/new-types/type-lambdas.html
33
*/
44
object TypeLambdas {
55

src/main/scala/UnionTypes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Union Types: http://dotty.epfl.ch/docs/reference/union-types.html
2+
* Union Types: https://dotty.epfl.ch/docs/reference/new-types/union-types.html
33
*/
44
object UnionTypes {
55

0 commit comments

Comments
 (0)