Skip to content

Commit

Permalink
Merge branch 'main' into report-all-warns-werror
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-rd committed Nov 17, 2023
2 parents dedd819 + 772be76 commit 544ff54
Show file tree
Hide file tree
Showing 960 changed files with 48,435 additions and 5,551 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ jobs:
run: |
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
- name: Test with Scala 2 library TASTy
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation i5; scala3-bootstrapped/testCompilation tests/run/typelevel-peano.scala" # only test a subset of test to avoid doubling the CI execution time

test_windows_fast:
runs-on: [self-hosted, Windows]
if: "(
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/lts-backport.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Add to backporting project

on:
pull_request:
types:
- closed
push:
branches:
- main

jobs:
add-to-backporting-project:
if: "github.event.pull_request.merged == true
&& github.event.pull_request.base.ref == 'main'
&& !contains(github.event.pull_request.body, '[Next only]')"
if: "!contains(github.event.push.head_commit.message, '[Next only]')"
runs-on: ubuntu-latest

steps:
Expand All @@ -18,7 +16,7 @@ jobs:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: VirtusLab/[email protected]
- run: scala-cli ./project/scripts/addToBackportingProject.scala -- ${{ github.event.pull_request.number }}
- run: scala-cli ./project/scripts/addToBackportingProject.scala -- ${{ github.sha }}
env:
GRAPHQL_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GRAPHQL_API_TOKEN: ${{ secrets.GRAPHQL_API_TOKEN }}

2 changes: 1 addition & 1 deletion community-build/community-projects/munit
Submodule munit updated 1 files
+0 −1 .jvmopts
2 changes: 1 addition & 1 deletion community-build/community-projects/scalaz
6 changes: 3 additions & 3 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def exec(projectDir: Path, binary: String, arguments: Seq[String], environment:
import scala.jdk.CollectionConverters._
val command = binary +: arguments
log(command.mkString(" "))
val builder = new ProcessBuilder(command: _*).directory(projectDir.toFile).inheritIO()
val builder = new ProcessBuilder(command*).directory(projectDir.toFile).inheritIO()
builder.environment.putAll(environment.asJava)
val process = builder.start()
val exitCode = process.waitFor()
Expand Down Expand Up @@ -362,7 +362,7 @@ object projects:
project = "shapeless-3",
sbtTestCommand = "testJVM; testJS",
sbtDocCommand = forceDoc("typeable", "deriving"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), // due to -Xfatal-warnings
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), // due to -Xfatal-warnings
)

lazy val xmlInterpolator = SbtCommunityProject(
Expand Down Expand Up @@ -404,7 +404,7 @@ object projects:
project = "zio",
sbtTestCommand = "testJVMDotty",
sbtDocCommand = forceDoc("coreJVM"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Xcheck-macros"),
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Xcheck-macros"),
dependencies =List(izumiReflect)
)

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/MainGenericRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ object MainGenericRunner {

case ExecuteMode.PossibleRun =>
val newClasspath = (settings.classPath :+ ".").flatMap(_.split(classpathSeparator).filter(_.nonEmpty)).map(File(_).toURI.toURL)
import dotty.tools.runner.RichClassLoader._
import dotty.tools.runner.RichClassLoader.*
val newClassLoader = ScalaClassLoader.fromURLsParallelCapable(newClasspath)
val targetToRun = settings.possibleEntryPaths.to(LazyList).find { entryPath =>
newClassLoader.tryToLoadClass(entryPath).orElse {
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/backend/jvm/BCodeAsmCommon.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package jvm

import scala.language.unsafeNulls

import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Flags.*
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.report

/**
Expand Down
38 changes: 19 additions & 19 deletions compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import BCodeHelpers.InvokeStyle

import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Constants._
import dotty.tools.dotc.core.Constants.*
import dotty.tools.dotc.core.Flags.{Label => LabelFlag, _}
import dotty.tools.dotc.core.Types._
import dotty.tools.dotc.core.Types.*
import dotty.tools.dotc.core.StdNames.{nme, str}
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.transform.Erasure
import dotty.tools.dotc.transform.SymUtils._
import dotty.tools.dotc.util.Spans._
import dotty.tools.dotc.core.Contexts._
import dotty.tools.dotc.core.Phases._
import dotty.tools.dotc.transform.SymUtils.*
import dotty.tools.dotc.util.Spans.*
import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Phases.*
import dotty.tools.dotc.core.Decorators.em
import dotty.tools.dotc.report

Expand All @@ -33,13 +33,13 @@ import dotty.tools.dotc.report
*
*/
trait BCodeBodyBuilder extends BCodeSkelBuilder {
// import global._
// import definitions._
import tpd._
// import global.*
// import definitions.*
import tpd.*
import int.{_, given}
import DottyBackendInterface.symExtensions
import bTypes._
import coreBTypes._
import bTypes.*
import coreBTypes.*

protected val primitives: DottyPrimitives

Expand Down Expand Up @@ -126,7 +126,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
assert(resKind.isNumericType || (resKind == BOOL),
s"$resKind is not a numeric or boolean type [operation: ${fun.symbol}]")

import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*

args match {
// unary operation
Expand Down Expand Up @@ -179,7 +179,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
def genArrayOp(tree: Tree, code: Int, expectedType: BType): BType = tree match{

case Apply(DesugaredSelect(arrayObj, _), args) =>
import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*
val k = tpeTK(arrayObj)
genLoad(arrayObj, k)
val elementType = typeOfArrayOp.getOrElse[bTypes.BType](code, abort(s"Unknown operation on arrays: $tree code: $code"))
Expand Down Expand Up @@ -262,7 +262,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {

val code = primitives.getPrimitive(tree, receiver.tpe)

import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*

if (isArithmeticOp(code)) genArithmeticOp(tree, code)
else if (code == CONCAT) genStringConcat(tree)
Expand Down Expand Up @@ -1267,7 +1267,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {

/* Generate coercion denoted by "code" */
def genCoercion(code: Int): Unit = {
import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*
(code: @switch) match {
case B2B | S2S | C2C | I2I | L2L | F2F | D2D => ()
case _ =>
Expand Down Expand Up @@ -1443,7 +1443,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
val mdescr = bmType.descriptor

val isInterface = isEmittedInterface(receiverClass)
import InvokeStyle._
import InvokeStyle.*
if (style == Super) {
if (isInterface && !method.is(JavaDefined)) {
val args = new Array[BType](bmType.argumentTypes.length + 1)
Expand Down Expand Up @@ -1497,7 +1497,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
} else if (tk.isRef) { // REFERENCE(_) | ARRAY(_)
bc.emitIF_ACMP(op, success)
} else {
import Primitives._
import Primitives.*
def useCmpG = if (negated) op == GT || op == GE else op == LT || op == LE
(tk: @unchecked) match {
case LONG => emit(asm.Opcodes.LCMP)
Expand All @@ -1512,7 +1512,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {

/* Emits code to compare (and consume) stack-top and zero using the 'op' operator */
private def genCZJUMP(success: asm.Label, failure: asm.Label, op: TestOp, tk: BType, targetIfNoJump: asm.Label, negated: Boolean = false): Unit = {
import Primitives._
import Primitives.*
if (targetIfNoJump == success) genCZJUMP(failure, success, op.negate(), tk, targetIfNoJump, negated = !negated)
else {
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
Expand Down
39 changes: 20 additions & 19 deletions compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ import scala.tools.asm
import scala.tools.asm.AnnotationVisitor
import scala.tools.asm.ClassWriter
import scala.collection.mutable
import scala.compiletime.uninitialized

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.ast.Trees
import dotty.tools.dotc.core.Annotations._
import dotty.tools.dotc.core.Constants._
import dotty.tools.dotc.core.Contexts._
import dotty.tools.dotc.core.Phases._
import dotty.tools.dotc.core.Decorators._
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.core.Annotations.*
import dotty.tools.dotc.core.Constants.*
import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Phases.*
import dotty.tools.dotc.core.Decorators.*
import dotty.tools.dotc.core.Flags.*
import dotty.tools.dotc.core.Names.Name
import dotty.tools.dotc.core.NameKinds.ExpandedName
import dotty.tools.dotc.core.Signature
import dotty.tools.dotc.core.StdNames._
import dotty.tools.dotc.core.StdNames.*
import dotty.tools.dotc.core.NameKinds
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.core.Types
import dotty.tools.dotc.core.Types._
import dotty.tools.dotc.core.Types.*
import dotty.tools.dotc.core.TypeErasure
import dotty.tools.dotc.transform.GenericSignatures
import dotty.tools.dotc.transform.ElimErasedValueType
Expand All @@ -44,12 +45,12 @@ import dotty.tools.backend.jvm.DottyBackendInterface.symExtensions
*/
trait BCodeHelpers extends BCodeIdiomatic {
// for some reason singleton types aren't allowed in constructor calls. will need several casts in code to enforce
//import global._
import bTypes._
import tpd._
import coreBTypes._
//import global.*
import bTypes.*
import tpd.*
import coreBTypes.*
import int.{_, given}
import DottyBackendInterface._
import DottyBackendInterface.*

// We need to access GenBCode phase to get access to post-processor components.
// At this point it should always be initialized already.
Expand Down Expand Up @@ -576,7 +577,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
/* builder of mirror classes */
class JMirrorBuilder extends JCommonBuilder {

private var cunit: CompilationUnit = _
private var cunit: CompilationUnit = uninitialized
def getCurrentCUnit(): CompilationUnit = cunit;

/* Generate a mirror class for a top-level module. A mirror class is a class
Expand Down Expand Up @@ -700,10 +701,10 @@ trait BCodeHelpers extends BCodeIdiomatic {
* classes.
*/
private def typeToTypeKind(tp: Type)(ct: BCodeHelpers)(storage: ct.BCInnerClassGen): ct.bTypes.BType = {
import ct.bTypes._
import ct.bTypes.*
val defn = ctx.definitions
import coreBTypes._
import Types._
import coreBTypes.*
import Types.*
/**
* Primitive types are represented as TypeRefs to the class symbol of, for example, scala.Int.
* The `primitiveTypeMap` maps those class symbols to the corresponding PrimitiveBType.
Expand Down Expand Up @@ -851,7 +852,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
object BCodeHelpers {

class InvokeStyle(val style: Int) extends AnyVal {
import InvokeStyle._
import InvokeStyle.*
def isVirtual: Boolean = this == Virtual
def isStatic : Boolean = this == Static
def isSpecial: Boolean = this == Special
Expand Down
10 changes: 5 additions & 5 deletions compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ trait BCodeIdiomatic {
val bTypes: BTypesFromSymbols[int.type]

import int.{_, given}
import bTypes._
import coreBTypes._
import bTypes.*
import coreBTypes.*


lazy val JavaStringBuilderClassName = jlStringBuilderRef.internalName
Expand Down Expand Up @@ -617,7 +617,7 @@ trait BCodeIdiomatic {
/* Constant-valued val-members of JCodeMethodN at the companion object, so as to avoid re-initializing them multiple times. */
object JCodeMethodN {

import asm.Opcodes._
import asm.Opcodes.*

// ---------------- conversions ----------------

Expand Down Expand Up @@ -651,7 +651,7 @@ trait BCodeIdiomatic {
* can-multi-thread
*/
final def coercionFrom(code: Int): BType = {
import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*
(code: @switch) match {
case B2B | B2C | B2S | B2I | B2L | B2F | B2D => BYTE
case S2B | S2S | S2C | S2I | S2L | S2F | S2D => SHORT
Expand All @@ -668,7 +668,7 @@ trait BCodeIdiomatic {
* can-multi-thread
*/
final def coercionTo(code: Int): BType = {
import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*
(code: @switch) match {
case B2B | C2B | S2B | I2B | L2B | F2B | D2B => BYTE
case B2C | C2C | S2C | I2C | L2C | F2C | D2C => CHAR
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import dotty.tools.dotc.transform.SymUtils.*
trait BCodeSkelBuilder extends BCodeHelpers {
import int.{_, given}
import DottyBackendInterface.{symExtensions, _}
import tpd._
import bTypes._
import coreBTypes._
import bCodeAsmCommon._
import tpd.*
import bTypes.*
import coreBTypes.*
import bCodeAsmCommon.*

lazy val NativeAttr: Symbol = requiredClass[scala.native]

Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/backend/jvm/BCodeSyncAndTry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.tools.asm

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.StdNames.nme
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.ast.tpd

/*
Expand All @@ -20,9 +20,9 @@ import dotty.tools.dotc.ast.tpd
*/
trait BCodeSyncAndTry extends BCodeBodyBuilder {
import int.given
import tpd._
import bTypes._
import coreBTypes._
import tpd.*
import bTypes.*
import coreBTypes.*
/*
* Functionality to lower `synchronized` and `try` expressions.
*/
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/backend/jvm/BTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class BTypes { self =>
def classBTypeFromInternalName(internalName: String) = classBTypeFromInternalNameMap(internalName)

val coreBTypes: CoreBTypes { val bTypes: self.type}
import coreBTypes._
import coreBTypes.*

/**
* A BType is either a primitve type, a ClassBType, an ArrayBType of one of these, or a MethodType
Expand Down
Loading

0 comments on commit 544ff54

Please sign in to comment.