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

Update Scala to 3.0.0-RC1 #103

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mill._, scalalib._, scalajslib._, scalanativelib._, publish._

val dottyVersions = sys.props.get("dottyVersion").toList

val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0-M3" :: dottyVersions
val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0-RC1" :: dottyVersions
val scala2Versions = scalaVersions.filter(_.startsWith("2."))

val scalaJSVersions = for {
Expand Down
2 changes: 1 addition & 1 deletion mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.9.4-18-82ea87
DEFAULT_MILL_VERSION=0.9.5

set -e

Expand Down
8 changes: 7 additions & 1 deletion sourcecode/src-3/sourcecode/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,14 @@ object Macros {
owner match {
case defSym if defSym.isDefDef =>
defSym.tree.asInstanceOf[DefDef].paramss
// FIXME Could be a List[TypeDef] too, although I'm not
// sure under which conditions this can happen…
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can currently happen with extension methods with a type parameter clause on the extension block and the method itself (cf scala/scala3#10940), and in the (post-3.0) future we plan to allow users to add type parameter clauses after term parameter clauses in all methods.

.map(_.asInstanceOf[List[ValDef]])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paramss is a List[ParamClause[T], with ParamClause[T] being List[ValDef[T]] | List[TypeDef[T]]. So we can't just match paramss with

paramss match {
  case l: List[ValDef] =>
  case l: List[TypeDef] =>
}

because of type erasure.

case classSym if classSym.isClassDef =>
classSym.tree.asInstanceOf[ClassDef].constructor.paramss
// FIXME Could be a List[TypeDef] too, although I'm not
// sure under which conditions this can happen…
.map(_.asInstanceOf[List[ValDef]])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

case _ =>
nearestEnclosingMethod(owner.owner)
}
Expand All @@ -213,7 +219,7 @@ object Macros {

def text[T: Type](v: Expr[T])(using Quotes): Expr[sourcecode.Text[T]] = {
import quotes.reflect._
val txt = Term.of(v).pos.sourceCode.get
val txt = v.asTerm.pos.sourceCode.get
'{sourcecode.Text[T]($v, ${Expr(txt)})}
}

Expand Down