From 23867a39ec204a0664b69b08d3aaeb4dda7a35c1 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 3 Oct 2018 18:13:47 +0200 Subject: [PATCH 1/7] Setup scalafix --- project/Build.scala | 15 ++++++++++++--- project/plugins.sbt | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 996be0324162..44f90d7b9c13 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -23,6 +23,7 @@ import sbtbuildinfo.BuildInfoPlugin import sbtbuildinfo.BuildInfoPlugin.autoImport._ import scala.util.Properties.isJavaAtLeast +import scalafix.sbt.ScalafixPlugin.autoImport._ /* In sbt 0.13 the Build trait would expose all vals to the shell, where you * can use them in "set a := b" like expressions. This re-exposes them. @@ -88,7 +89,6 @@ object Build { lazy val dotr = inputKey[Unit]("run compiled binary using the correct classpath, or the user supplied classpath") - // Compiles the documentation and static site lazy val genDocs = taskKey[Unit]("run dottydoc to generate static documentation site") @@ -114,10 +114,12 @@ object Build { organizationHomepage := Some(url("http://lamp.epfl.ch")), scalacOptions ++= Seq( + "-Yrangepos", "-feature", "-deprecation", + "-Ywarn-unused-import", "-unchecked", - "-Xfatal-warnings", + // "-Xfatal-warnings", "-encoding", "UTF8", "-language:existentials,higherKinds,implicitConversions" ), @@ -745,7 +747,14 @@ object Build { def dottyCompilerSettings(implicit mode: Mode): sbt.Def.SettingsDefinition = if (mode == NonBootstrapped) nonBootstrapedDottyCompilerSettings else bootstrapedDottyCompilerSettings - lazy val `dotty-compiler` = project.in(file("compiler")).asDottyCompiler(NonBootstrapped) + lazy val `dotty-compiler` = project + .settings(addCompilerPlugin(scalafixSemanticdb)) + .settings(scalafixDependencies in ThisBuild += + // "com.geirsson" %% "example-scalafix-rule" % "1.3.0" + "com.twitter" %% "rsc-rules" % "0.0.0-406-6829ec44-20181004-1416" + ) + .in(file("compiler")).asDottyCompiler(NonBootstrapped) + lazy val `dotty-compiler-bootstrapped` = project.in(file("compiler")).asDottyCompiler(Bootstrapped) def dottyCompiler(implicit mode: Mode): Project = mode match { diff --git a/project/plugins.sbt b/project/plugins.sbt index 5cd6b814e6fb..1bfa60fb9415 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -16,3 +16,5 @@ addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.10.1") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.2") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") + +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.0") From 221bde99f96c6cb1ff062260aff1989457e59be5 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 3 Oct 2018 18:13:53 +0200 Subject: [PATCH 2/7] Remove unused imports Using dotty-compiler/scalafix RemoveUnused --- .../backend/jvm/CollectEntryPoints.scala | 18 +---------------- .../tools/backend/jvm/CollectSuperCalls.scala | 1 - .../backend/jvm/DottyBackendInterface.scala | 16 ++++----------- .../dotty/tools/backend/jvm/GenBCode.scala | 3 +-- .../dotty/tools/backend/jvm/LabelDefs.scala | 1 - .../tools/backend/jvm/scalaPrimitives.scala | 2 +- compiler/src/dotty/tools/dotc/Compiler.scala | 10 +--------- compiler/src/dotty/tools/dotc/Driver.scala | 1 - compiler/src/dotty/tools/dotc/Run.scala | 5 +---- .../src/dotty/tools/dotc/ast/Desugar.scala | 3 +-- .../dotty/tools/dotc/ast/DesugarEnums.scala | 4 +--- .../src/dotty/tools/dotc/ast/Positioned.scala | 1 - .../src/dotty/tools/dotc/ast/TreeInfo.scala | 5 +---- .../dotty/tools/dotc/ast/TreeTypeMap.scala | 6 +++--- compiler/src/dotty/tools/dotc/ast/Trees.scala | 7 +------ compiler/src/dotty/tools/dotc/ast/tpd.scala | 5 ++--- compiler/src/dotty/tools/dotc/ast/untpd.scala | 7 ++----- .../dotc/classpath/AggregateClassPath.scala | 1 - .../dotc/classpath/ClassPathFactory.scala | 1 - .../dotc/classpath/DirectoryClassPath.scala | 7 ++----- .../classpath/VirtualDirectoryClassPath.scala | 2 +- .../tools/dotc/config/CompilerCommand.scala | 1 - .../tools/dotc/config/JavaPlatform.scala | 4 ++-- .../tools/dotc/config/PathResolver.scala | 7 +++---- .../dotty/tools/dotc/config/Properties.scala | 2 +- .../tools/dotc/config/ScalaSettings.scala | 1 - .../dotty/tools/dotc/config/Settings.scala | 4 ++-- .../dotty/tools/dotc/core/Annotations.scala | 4 ++-- .../tools/dotc/core/CheckRealizable.scala | 8 ++------ .../dotty/tools/dotc/core/Constraint.scala | 8 ++------ .../tools/dotc/core/ConstraintHandling.scala | 2 -- .../src/dotty/tools/dotc/core/Contexts.scala | 8 +------- .../dotty/tools/dotc/core/Decorators.scala | 2 +- .../dotty/tools/dotc/core/Definitions.scala | 8 +++----- .../tools/dotc/core/DenotTransformers.scala | 2 -- .../dotty/tools/dotc/core/Denotations.scala | 3 --- .../src/dotty/tools/dotc/core/NameKinds.scala | 2 -- .../src/dotty/tools/dotc/core/NameOps.scala | 5 +---- .../src/dotty/tools/dotc/core/Names.scala | 4 ---- .../tools/dotc/core/OrderingConstraint.scala | 3 +-- .../src/dotty/tools/dotc/core/Periods.scala | 1 - .../src/dotty/tools/dotc/core/Phases.scala | 4 +--- .../src/dotty/tools/dotc/core/Scopes.scala | 3 --- .../src/dotty/tools/dotc/core/StdNames.scala | 4 +--- .../dotty/tools/dotc/core/Substituters.scala | 2 +- .../tools/dotc/core/SymDenotations.scala | 7 +------ .../dotty/tools/dotc/core/SymbolLoaders.scala | 6 ++---- .../src/dotty/tools/dotc/core/Symbols.scala | 5 +---- .../tools/dotc/core/TypeApplications.scala | 11 +--------- .../dotty/tools/dotc/core/TypeComparer.scala | 8 ++++---- .../dotty/tools/dotc/core/TypeErasure.scala | 4 +--- .../dotty/tools/dotc/core/TypeErrors.scala | 1 - .../src/dotty/tools/dotc/core/TypeOps.scala | 10 ++-------- .../dotty/tools/dotc/core/TyperState.scala | 6 +----- .../src/dotty/tools/dotc/core/Types.scala | 8 ++------ .../src/dotty/tools/dotc/core/Uniques.scala | 2 +- .../dotc/core/classfile/ClassfileParser.scala | 2 +- .../dotc/core/tasty/CommentUnpickler.scala | 1 - .../dotc/core/tasty/DottyUnpickler.scala | 7 ++----- .../tools/dotc/core/tasty/NameBuffer.scala | 2 -- .../dotc/core/tasty/PositionPickler.scala | 4 +--- .../dotc/core/tasty/PositionUnpickler.scala | 2 +- .../tools/dotc/core/tasty/TastyPrinter.scala | 7 ++----- .../dotc/core/tasty/TastyUnpickler.scala | 4 +--- .../tools/dotc/core/tasty/TreePickler.scala | 9 +++------ .../tools/dotc/core/tasty/TreeUnpickler.scala | 8 +++----- .../core/unpickleScala2/Scala2Flags.scala | 1 - .../core/unpickleScala2/Scala2Unpickler.scala | 5 ++--- .../decompiler/DecompilationPrinter.scala | 3 +-- .../dotty/tools/dotc/decompiler/Main.scala | 2 +- .../fromtasty/ReadTastyTreesFromClasses.scala | 6 +----- .../tools/dotc/interactive/Interactive.scala | 3 +-- .../interactive/InteractiveCompiler.scala | 1 - .../dotc/interactive/InteractiveDriver.scala | 6 +----- .../tools/dotc/interactive/SourceTree.scala | 2 +- .../tools/dotc/parsing/JavaParsers.scala | 3 --- .../tools/dotc/parsing/JavaScanners.scala | 2 +- .../dotty/tools/dotc/parsing/Parsers.scala | 3 --- .../dotty/tools/dotc/parsing/Scanners.scala | 2 -- .../dotc/parsing/xml/SymbolicXMLBuilder.scala | 1 - .../dotty/tools/dotc/plugins/Plugins.scala | 1 - .../dotc/printing/DecompilerPrinter.scala | 1 - .../tools/dotc/printing/Formatting.scala | 5 +---- .../tools/dotc/printing/PlainPrinter.scala | 5 ++--- .../dotty/tools/dotc/printing/Printer.scala | 2 +- .../tools/dotc/printing/RefinedPrinter.scala | 17 ++++------------ .../tools/dotc/printing/ReplPrinter.scala | 3 +-- .../dotty/tools/dotc/printing/Showable.scala | 1 - .../dotc/printing/SyntaxHighlighting.scala | 1 - .../dotty/tools/dotc/printing/package.scala | 1 - .../tools/dotc/quoted/QuoteCompiler.scala | 4 +--- .../dotc/reporting/ConsoleReporter.scala | 4 ++-- .../dotc/reporting/MessageRendering.scala | 2 +- .../dotty/tools/dotc/reporting/Reporter.scala | 1 - .../dotc/reporting/ThrowingReporter.scala | 2 -- .../reporting/UniqueMessagePositions.scala | 2 +- .../dotc/reporting/diagnostic/Message.scala | 1 - .../dotty/tools/dotc/rewrites/Rewrites.scala | 2 +- .../dotc/tastyreflect/CaseDefOpsImpl.scala | 1 - .../dotc/tastyreflect/ConstantOpsImpl.scala | 1 - .../dotc/tastyreflect/ContextOpsImpl.scala | 1 - .../dotc/tastyreflect/PatternOpsImpl.scala | 1 - .../tastyreflect/StandardDefinitions.scala | 1 - .../tools/dotc/tastyreflect/TreeOpsImpl.scala | 1 - .../tastyreflect/TypeOrBoundsOpsImpl.scala | 2 -- .../TypeOrBoundsTreesOpsImpl.scala | 1 - .../tools/dotc/transform/AccessProxies.scala | 2 -- .../dotc/transform/ArrayConstructors.scala | 10 ---------- .../dotc/transform/AugmentScala2Traits.scala | 2 -- .../dotty/tools/dotc/transform/Bridges.scala | 4 +--- .../tools/dotc/transform/ByNameClosures.scala | 3 --- .../tools/dotc/transform/CapturedVars.scala | 7 +------ .../tools/dotc/transform/CheckReentrant.scala | 13 ------------ .../dotty/tools/dotc/transform/ClassOf.scala | 5 +---- .../dotc/transform/CollectEntryPoints.scala | 9 +-------- .../transform/CollectNullableFields.scala | 2 -- .../tools/dotc/transform/Constructors.scala | 4 ---- .../tools/dotc/transform/CrossCastAnd.scala | 3 +-- .../tools/dotc/transform/ElimByName.scala | 6 ------ .../dotc/transform/ElimErasedValueType.scala | 6 +++--- .../dotc/transform/ElimOuterSelect.scala | 2 -- .../tools/dotc/transform/ElimRepeated.scala | 7 ------- .../tools/dotc/transform/ElimStaticThis.scala | 2 -- .../dotty/tools/dotc/transform/Erasure.scala | 4 +--- .../tools/dotc/transform/ExpandPrivate.scala | 8 +------- .../tools/dotc/transform/ExpandSAMs.scala | 2 -- .../tools/dotc/transform/ExplicitOuter.scala | 1 - .../tools/dotc/transform/ExplicitSelf.scala | 2 -- .../dotc/transform/ExtensionMethods.scala | 12 ++++------- .../tools/dotc/transform/FirstTransform.scala | 7 +------ .../dotty/tools/dotc/transform/Flatten.scala | 1 - .../dotc/transform/FullParameterization.scala | 1 - .../dotc/transform/FunctionalInterfaces.scala | 10 ---------- .../dotty/tools/dotc/transform/GetClass.scala | 1 - .../dotty/tools/dotc/transform/Getters.scala | 3 --- .../tools/dotc/transform/HoistSuperArgs.scala | 1 - .../tools/dotc/transform/LambdaLift.scala | 8 +++----- .../dotty/tools/dotc/transform/LazyVals.scala | 14 +++---------- .../dotc/transform/LinkScala2Impls.scala | 5 ----- .../tools/dotc/transform/MacroTransform.scala | 1 - .../MacroTransformWithImplicits.scala | 3 --- .../tools/dotc/transform/MegaPhase.scala | 7 +------ .../dotty/tools/dotc/transform/Memoize.scala | 2 -- .../dotty/tools/dotc/transform/Mixin.scala | 3 --- .../dotty/tools/dotc/transform/MixinOps.scala | 2 +- .../tools/dotc/transform/MoveStatics.scala | 6 ++---- .../dotc/transform/NonLocalReturns.scala | 4 +--- .../dotc/transform/OverridingPairs.scala | 3 +-- .../dotc/transform/ParamForwarding.scala | 2 +- .../tools/dotc/transform/PatternMatcher.scala | 5 ++--- .../dotc/transform/PrimitiveForwarders.scala | 12 ----------- .../dotc/transform/ProtectedAccessors.scala | 2 -- .../dotc/transform/PruneErasedDefs.scala | 1 - .../tools/dotc/transform/RenameLifted.scala | 1 - .../tools/dotc/transform/ResolveSuper.scala | 7 ------- .../tools/dotc/transform/RestoreScopes.scala | 3 --- .../tools/dotc/transform/SeqLiterals.scala | 4 ---- .../dotc/transform/ShortcutImplicits.scala | 4 ---- .../dotty/tools/dotc/transform/Splitter.scala | 2 +- .../tools/dotc/transform/SuperAccessors.scala | 2 +- .../dotty/tools/dotc/transform/SymUtils.scala | 2 -- .../dotc/transform/SyntheticMethods.scala | 8 +------- .../dotty/tools/dotc/transform/TailRec.scala | 1 - .../tools/dotc/transform/TreeChecker.scala | 10 ---------- .../tools/dotc/transform/TreeExtractors.scala | 4 ++-- .../dotc/transform/TryCatchPatterns.scala | 1 - .../tools/dotc/transform/TypeUtils.scala | 4 ---- .../dotc/transform/VCElideAllocations.scala | 10 +++++----- .../dotc/transform/VCInlineMethods.scala | 5 ++--- .../dotty/tools/dotc/typer/Applications.scala | 10 +--------- .../src/dotty/tools/dotc/typer/Dynamic.scala | 1 - .../dotty/tools/dotc/typer/EtaExpansion.scala | 5 +---- .../dotty/tools/dotc/typer/Implicits.scala | 10 +++------- .../dotty/tools/dotc/typer/ImportInfo.scala | 3 +-- .../dotty/tools/dotc/typer/Inferencing.scala | 10 ++-------- .../src/dotty/tools/dotc/typer/Inliner.scala | 12 +---------- .../src/dotty/tools/dotc/typer/Namer.scala | 10 +++------- .../tools/dotc/typer/PrepareInlineable.scala | 20 ++++--------------- .../dotty/tools/dotc/typer/ProtoTypes.scala | 8 +------- .../src/dotty/tools/dotc/typer/ReTyper.scala | 2 -- .../dotty/tools/dotc/typer/RefChecks.scala | 1 - .../dotty/tools/dotc/typer/TypeAssigner.scala | 5 ++--- .../src/dotty/tools/dotc/typer/Typer.scala | 7 +------ .../tools/dotc/typer/VarianceChecker.scala | 3 +-- .../dotty/tools/dotc/typer/Variances.scala | 5 +---- .../tools/dotc/util/NameTransformer.scala | 1 - .../dotty/tools/dotc/util/ShowPickled.scala | 2 +- .../dotty/tools/dotc/util/SourceFile.scala | 2 -- .../src/dotty/tools/dotc/util/common.scala | 1 - .../src/dotty/tools/io/AbstractFile.scala | 2 +- compiler/src/dotty/tools/io/Directory.scala | 2 -- compiler/src/dotty/tools/io/File.scala | 2 +- compiler/src/dotty/tools/io/Jar.scala | 4 ++-- compiler/src/dotty/tools/io/Path.scala | 1 - compiler/src/dotty/tools/io/PlainFile.scala | 1 - compiler/src/dotty/tools/io/ZipArchive.scala | 5 ++--- compiler/src/dotty/tools/package.scala | 1 - .../src/dotty/tools/repl/ParseResult.scala | 2 -- compiler/src/dotty/tools/repl/Rendering.scala | 2 -- .../src/dotty/tools/repl/ReplCompiler.scala | 1 - .../src/dotty/tools/repl/ReplDriver.scala | 1 - compiler/src/dotty/tools/repl/package.scala | 1 - 202 files changed, 172 insertions(+), 675 deletions(-) diff --git a/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala b/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala index 8e7cfc688724..b8363a9f79c2 100644 --- a/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala +++ b/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala @@ -5,30 +5,15 @@ import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Types import dotty.tools.dotc.transform.MegaPhase._ import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc -import dotty.tools.dotc.core.Flags.FlagSet -import dotty.tools.dotc.transform.Erasure -import dotty.tools.dotc.transform.SymUtils._ -import java.io.{File => JFile} +import java.io.{File => _} -import scala.collection.generic.Clearable -import scala.collection.mutable -import scala.reflect.ClassTag -import dotty.tools.io.{Directory, PlainDirectory, AbstractFile} -import scala.tools.asm.{ClassVisitor, FieldVisitor, MethodVisitor} -import scala.tools.nsc.backend.jvm.{BCodeHelpers, BackendInterface} import dotty.tools.dotc.core._ -import Periods._ import SymDenotations._ import Contexts._ import Types._ import Symbols._ -import Denotations._ -import Phases._ -import java.lang.AssertionError import dotty.tools.dotc.util.Positions.Position import Decorators._ -import tpd._ import StdNames.nme /** @@ -56,7 +41,6 @@ object CollectEntryPoints{ } def isJavaEntryPoint(sym: Symbol)(implicit ctx: Context): Boolean = { - import Types.MethodType val d = ctx.definitions val StringType = d.StringType // The given class has a main method. diff --git a/compiler/src/dotty/tools/backend/jvm/CollectSuperCalls.scala b/compiler/src/dotty/tools/backend/jvm/CollectSuperCalls.scala index cabc51c394bf..8e646b5b7d81 100644 --- a/compiler/src/dotty/tools/backend/jvm/CollectSuperCalls.scala +++ b/compiler/src/dotty/tools/backend/jvm/CollectSuperCalls.scala @@ -1,7 +1,6 @@ package dotty.tools.backend.jvm import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.ast.Trees._ import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.core.Flags.Trait diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 8114a00f80a9..c9a61eac7b1c 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -6,37 +6,29 @@ import dotty.tools.dotc import dotty.tools.dotc.core.Flags.FlagSet import dotty.tools.dotc.transform.{Erasure, GenericSignatures} import dotty.tools.dotc.transform.SymUtils._ -import java.io.{File => JFile} +import java.io.{File => _} import scala.collection.generic.Clearable import scala.collection.mutable import scala.reflect.ClassTag import scala.reflect.internal.util.WeakHashSet -import dotty.tools.io.{AbstractFile, Directory, PlainDirectory} -import scala.tools.asm.{AnnotationVisitor, ClassVisitor, FieldVisitor, MethodVisitor} +import dotty.tools.io.AbstractFile +import scala.tools.asm.AnnotationVisitor import scala.tools.nsc.backend.jvm.{BCodeHelpers, BackendInterface} import dotty.tools.dotc.core._ -import Periods._ -import SymDenotations._ import Contexts._ import Types._ import Symbols._ -import Denotations._ import Phases._ -import java.lang.AssertionError -import dotty.tools.dotc.util.{DotClass, Positions} +import dotty.tools.dotc.util.Positions import Decorators._ import tpd._ import scala.tools.asm import StdNames.{nme, str} -import NameOps._ import NameKinds.{DefaultGetterName, ExpandedName} -import dotty.tools.dotc.core -import dotty.tools.dotc.core.Names.TypeName -import scala.annotation.tailrec class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Map[Symbol, Set[ClassSymbol]])(implicit ctx: Context) extends BackendInterface{ import Symbols.{toDenot, toClassDenot} diff --git a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala index ffae0c29ff7f..7ad6b9e74d62 100644 --- a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala @@ -20,13 +20,12 @@ import Decorators._ import java.io.DataOutputStream -import dotty.tools.io.Directory import scala.tools.asm import scala.tools.asm.tree._ import tpd._ import StdNames._ -import dotty.tools.dotc.core.tasty.{TastyBuffer, TastyHeaderUnpickler, TastyPickler} +import dotty.tools.dotc.core.tasty.{TastyBuffer, TastyHeaderUnpickler} import dotty.tools.io._ class GenBCode extends Phase { diff --git a/compiler/src/dotty/tools/backend/jvm/LabelDefs.scala b/compiler/src/dotty/tools/backend/jvm/LabelDefs.scala index b898e9496fe9..451ef95c288a 100644 --- a/compiler/src/dotty/tools/backend/jvm/LabelDefs.scala +++ b/compiler/src/dotty/tools/backend/jvm/LabelDefs.scala @@ -6,7 +6,6 @@ import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.transform.MegaPhase._ -import scala.collection.mutable /** * Verifies that each Label DefDef has only a single address to jump back and diff --git a/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala b/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala index fed7aeb81f63..66c247167ed8 100644 --- a/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala +++ b/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala @@ -14,7 +14,7 @@ import Names.TermName, StdNames._ import Types.{JavaArrayType, UnspecifiedErrorType, Type} import Symbols.{Symbol, NoSymbol} -import scala.collection.{ mutable, immutable } +import scala.collection.immutable /** Scala primitive operations are represented as methods in `Any` and diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index 564646b446c7..d3d03b8d98ae 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -3,17 +3,9 @@ package dotc import core._ import Contexts._ -import Periods._ -import Symbols._ -import Types._ -import Scopes._ -import typer.{FrontEnd, ImportInfo, RefChecks, Typer} -import reporting.{ConsoleReporter, Reporter} +import typer.{FrontEnd, RefChecks} import Phases.Phase import transform._ -import util.FreshNameCreator -import core.DenotTransformers.DenotTransformer -import core.Denotations.SingleDenotation import dotty.tools.backend.jvm.{CollectSuperCalls, GenBCode, LabelDefs} import dotty.tools.dotc.transform.localopt.StringInterpolatorOpt diff --git a/compiler/src/dotty/tools/dotc/Driver.scala b/compiler/src/dotty/tools/dotc/Driver.scala index 804f5379e8f0..f67ee91c5776 100644 --- a/compiler/src/dotty/tools/dotc/Driver.scala +++ b/compiler/src/dotty/tools/dotc/Driver.scala @@ -5,7 +5,6 @@ import config.CompilerCommand import core.Comments.{ContextDoc, ContextDocstrings} import core.Contexts.{Context, ContextBase} import core.Mode -import util.DotClass import reporting._ import scala.util.control.NonFatal import fromtasty.TASTYCompiler diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index 52694c0e5662..4e7568623b38 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -5,17 +5,15 @@ import core._ import Contexts._ import Periods._ import Symbols._ -import Phases._ import Types._ import Scopes._ -import typer.{FrontEnd, ImportInfo, RefChecks, Typer} +import typer.{ImportInfo, Typer} import Decorators._ import io.{AbstractFile, PlainFile} import scala.io.Codec import util.{Set => _, _} import reporting.Reporter -import transform.TreeChecker import rewrites.Rewrites import java.io.{BufferedWriter, OutputStreamWriter} @@ -26,7 +24,6 @@ import parsing.JavaParsers.JavaParser import typer.ImplicitRunInfo import collection.mutable -import scala.annotation.tailrec import dotty.tools.io.VirtualFile import scala.util.control.NonFatal diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index b22e31492156..221b6d764cf2 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -4,10 +4,9 @@ package ast import core._ import util.Positions._, Types._, Contexts._, Constants._, Names._, NameOps._, Flags._ -import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ +import Symbols._, StdNames._, Trees._ import Decorators._, transform.SymUtils._ import NameKinds.{UniqueName, EvidenceParamName, DefaultGetterName} -import language.higherKinds import typer.FrontEnd import collection.mutable.ListBuffer import reporting.diagnostic.messages._ diff --git a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala index 77fe8dd97379..ee77e23e92a8 100644 --- a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala +++ b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala @@ -4,9 +4,8 @@ package ast import core._ import util.Positions._, Types._, Contexts._, Constants._, Names._, NameOps._, Flags._ -import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ +import Symbols._, StdNames._, Trees._ import Decorators._ -import collection.mutable.ListBuffer import util.Property import typer.ErrorReporting._ @@ -15,7 +14,6 @@ import scala.annotation.internal.sharable /** Helper methods to desugar enums */ object DesugarEnums { import untpd._ - import desugar.DerivedFromParamTree @sharable object CaseKind extends Enumeration { val Simple, Object, Class = Value diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 87d46eb9a9bf..8e3839bb2b3c 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc package ast import util.Positions._ -import util.DotClass import core.Contexts.Context import core.Decorators._ import core.Flags.JavaDefined diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala index 73c20430c841..bdb387fdf42d 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -4,15 +4,13 @@ package ast import core._ import Flags._, Trees._, Types._, Contexts._ -import Names._, StdNames._, NameOps._, Decorators._, Symbols._ -import util.HashSet +import Names._, StdNames._, NameOps._, Symbols._ import typer.ConstFold import reporting.trace import scala.annotation.tailrec trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => - import TreeInfo._ // Note: the <: Type constraint looks necessary (and is needed to make the file compile in dotc). // But Scalac accepts the program happily without it. Need to find out why. @@ -287,7 +285,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => } trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped] => - import TreeInfo._ import untpd._ /** The underlying tree when stripping any TypedSplice or Parens nodes */ diff --git a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala index 856597b4b7ff..fee85dcb10ce 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -3,9 +3,9 @@ package dotc package ast import core._ -import Types._, Contexts._, Constants._, Names._, Flags._ -import SymDenotations._, Symbols._, Annotations._, Trees._, Symbols._ -import Denotations._, Decorators._ +import Types._, Contexts._ +import Symbols._, Annotations._, Trees._, Symbols._ +import Decorators._ import dotty.tools.dotc.transform.SymUtils._ import core.tasty.TreePickler.Hole diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 7e6aaa86f25c..8869ebc12711 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -5,18 +5,13 @@ package ast import core._ import Types._, Names._, NameOps._, Flags._, util.Positions._, Contexts._, Constants._ import SymDenotations._, Symbols._, Denotations._, StdNames._, Comments._ -import annotation.tailrec import language.higherKinds -import collection.IndexedSeqOptimized -import collection.immutable.IndexedSeq import collection.mutable.ListBuffer -import parsing.Tokens.Token import printing.Printer -import util.{Stats, Attachment, Property, DotClass} +import util.{Stats, Attachment, Property} import config.Config import annotation.internal.sharable import annotation.unchecked.uncheckedVariance -import language.implicitConversions object Trees { diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 471350ba3d03..8c8ed29ca71c 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -8,11 +8,10 @@ import transform.SymUtils._ import transform.TypeUtils._ import core._ import util.Positions._, Types._, Contexts._, Constants._, Names._, Flags._, NameOps._ -import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Symbols._ -import Denotations._, Decorators._, DenotTransformers._ +import Symbols._, StdNames._, Annotations._, Trees._, Symbols._ +import Decorators._, DenotTransformers._ import collection.mutable import util.{Property, SourceFile, NoSource} -import typer.ErrorReporting._ import NameKinds.{TempResultName, OuterSelectName} import scala.annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala index 054e4e604749..bc63791189ce 100644 --- a/compiler/src/dotty/tools/dotc/ast/untpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala @@ -3,13 +3,10 @@ package dotc package ast import core._ -import util.Positions._, Types._, Contexts._, Constants._, Names._, NameOps._, Flags._ -import Denotations._, SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ -import Decorators._ +import Types._, Contexts._, Constants._, Names._, Flags._ +import Symbols._, StdNames._, Trees._ import util.Property import language.higherKinds -import collection.mutable.ListBuffer -import reflect.ClassTag import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala index 227282ff9ebd..d0d499b28e65 100644 --- a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala @@ -5,7 +5,6 @@ package dotty.tools package dotc.classpath import java.net.URL -import scala.annotation.tailrec import scala.collection.mutable.ArrayBuffer import dotty.tools.io.{ AbstractFile, ClassPath, ClassRepresentation } diff --git a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala index fffbeac83116..0bdd0c33c287 100644 --- a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala +++ b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala @@ -4,7 +4,6 @@ package dotty.tools.dotc.classpath import dotty.tools.io.{AbstractFile, VirtualDirectory} -import dotty.tools.dotc.config.Settings import FileUtils.AbstractFileOps import dotty.tools.io.ClassPath import dotty.tools.dotc.core.Contexts.Context diff --git a/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala index 5e18859bae8d..9d36745e8536 100644 --- a/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala @@ -4,11 +4,8 @@ package dotty.tools.dotc.classpath import java.io.{File => JFile} -import java.net.{URI, URL} -import java.nio.file.{FileSystems, Files, SimpleFileVisitor} -import java.util.function.IntFunction -import java.util -import java.util.Comparator +import java.net.URL +import java.nio.file.{FileSystems, Files} import dotty.tools.io.{AbstractFile, PlainFile, ClassPath, ClassRepresentation} import FileUtils._ diff --git a/compiler/src/dotty/tools/dotc/classpath/VirtualDirectoryClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/VirtualDirectoryClassPath.scala index 51a97ef7ac14..1579e70afc55 100644 --- a/compiler/src/dotty/tools/dotc/classpath/VirtualDirectoryClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/VirtualDirectoryClassPath.scala @@ -1,7 +1,7 @@ package dotty.tools.dotc.classpath import dotty.tools.io.ClassRepresentation -import dotty.tools.io.{AbstractFile, Path, PlainFile, VirtualDirectory} +import dotty.tools.io.{AbstractFile, VirtualDirectory} import FileUtils._ import java.net.URL diff --git a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala index 81b4bdade5bf..23a6b9babd5e 100644 --- a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala @@ -5,7 +5,6 @@ import java.nio.file.{Files, Paths} import Settings._ import core.Contexts._ -import util.DotClass import Properties._ import scala.collection.JavaConverters._ diff --git a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala index f0db0deafb6d..97d9ec94890c 100644 --- a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala +++ b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala @@ -5,8 +5,8 @@ package config import io._ import classpath.AggregateClassPath import core._ -import Symbols._, Types._, Contexts._, Denotations._, SymDenotations._, StdNames._, Names._ -import Flags._, Scopes._, Decorators._, NameOps._, util.Positions._ +import Symbols._, Types._, Contexts._, SymDenotations._, StdNames._ +import Flags._ import transform.ExplicitOuter, transform.SymUtils._ class JavaPlatform extends Platform { diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index cb9abd70d236..cc4fe9f6084f 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -2,11 +2,10 @@ package dotty.tools package dotc package config -import java.net.{ URL, MalformedURLException } import WrappedProperties.AccessControl -import io.{ ClassPath, File, Directory, Path, AbstractFile } +import io.{ ClassPath, Directory, Path } import classpath.{AggregateClassPath, ClassPathFactory, JrtClassPath } -import ClassPath.{ JavaContext, join, split } +import ClassPath.split import PartialFunction.condOpt import scala.language.postfixOps import core.Contexts._ @@ -159,7 +158,7 @@ object PathResolver { } } } -import PathResolver.{ Defaults, Environment, firstNonEmpty, ppcp } +import PathResolver.{ Defaults, ppcp } class PathResolver(implicit ctx: Context) { import ctx.base.settings diff --git a/compiler/src/dotty/tools/dotc/config/Properties.scala b/compiler/src/dotty/tools/dotc/config/Properties.scala index a4523f5d4633..06d29e16c0c1 100644 --- a/compiler/src/dotty/tools/dotc/config/Properties.scala +++ b/compiler/src/dotty/tools/dotc/config/Properties.scala @@ -4,7 +4,7 @@ package config import scala.annotation.internal.sharable -import java.io.{ IOException, PrintWriter } +import java.io.IOException import java.util.jar.Attributes.{ Name => AttributeName } /** Loads `library.properties` from the jar. */ diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 234553118300..93d93eddebc0 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc package config -import java.io.File import dotty.tools.io.{ Directory, PlainDirectory } import PathResolver.Defaults diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index 35ed62aa6366..d8243e8beb4f 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -2,11 +2,11 @@ package dotty.tools.dotc package config import collection.mutable.{ ArrayBuffer } -import scala.util.{ Try, Success, Failure } +import scala.util.{ Success, Failure } import reflect.ClassTag import core.Contexts._ import scala.annotation.tailrec -import dotty.tools.io.{ AbstractFile, Directory, JarArchive, PlainDirectory, File, Path } +import dotty.tools.io.{ AbstractFile, Directory, JarArchive, PlainDirectory } // import annotation.unchecked // Dotty deviation: Imports take precedence over definitions in enclosing package diff --git a/compiler/src/dotty/tools/dotc/core/Annotations.scala b/compiler/src/dotty/tools/dotc/core/Annotations.scala index d99db77c36ae..6aae44177979 100644 --- a/compiler/src/dotty/tools/dotc/core/Annotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Annotations.scala @@ -1,10 +1,10 @@ package dotty.tools.dotc package core -import Symbols._, Types._, util.Positions._, Contexts._, Constants._, ast.tpd._ +import Symbols._, Types._, Contexts._, Constants._, ast.tpd._ import config.ScalaVersion import StdNames._ -import dotty.tools.dotc.ast.{tpd, untpd} +import dotty.tools.dotc.ast.tpd object Annotations { diff --git a/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala b/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala index 48c842a284f5..b427d5f0ffa2 100644 --- a/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala +++ b/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala @@ -2,14 +2,10 @@ package dotty.tools package dotc package core -import Contexts._, Types._, Symbols._, Names._, Flags._, Scopes._ -import SymDenotations._, Denotations.SingleDenotation -import util.Positions._ +import Contexts._, Types._, Symbols._, Names._, Flags._ +import Denotations.SingleDenotation import Decorators._ -import StdNames._ -import Annotations._ import collection.mutable -import ast.tpd._ /** Realizability status */ object CheckRealizable { diff --git a/compiler/src/dotty/tools/dotc/core/Constraint.scala b/compiler/src/dotty/tools/dotc/core/Constraint.scala index 02d4fc1dd5b9..946a19b24d30 100644 --- a/compiler/src/dotty/tools/dotc/core/Constraint.scala +++ b/compiler/src/dotty/tools/dotc/core/Constraint.scala @@ -2,12 +2,8 @@ package dotty.tools package dotc package core -import Types._, Contexts._, Symbols._ -import collection.mutable -import printing.{Printer, Showable} -import printing.Texts._ -import config.Config -import config.Printers.constr +import Types._, Contexts._ +import printing.Showable /** Constraint over undetermined type parameters. Constraints are built * over values of the following types: diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala index 87a168f26580..ced16169fae6 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -6,8 +6,6 @@ import Types._, Contexts._, Symbols._ import Decorators._ import config.Config import config.Printers.{constr, typr} -import TypeApplications.{EtaExpansion, TypeParamInfo} -import collection.mutable /** Methods for adding constraints and solving them. * diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index a80d25e16b04..ae01828cd9f1 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -10,11 +10,7 @@ import Phases._ import Types._ import Symbols._ import Scopes._ -import NameOps._ import Uniques._ -import SymDenotations._ -import Comments._ -import util.Positions._ import ast.Trees._ import ast.untpd import util.{FreshNameCreator, NoSource, SimpleIdentityMap, SourceFile} @@ -25,13 +21,11 @@ import config.Config import reporting._ import reporting.diagnostic.Message import collection.mutable -import collection.immutable.BitSet import printing._ -import config.{JavaPlatform, Platform, ScalaSettings, Settings} +import config.{JavaPlatform, Platform, ScalaSettings} import scala.annotation.internal.sharable -import language.implicitConversions import DenotTransformers.DenotTransformer import dotty.tools.dotc.profile.Profiler import util.Property.Key diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala index 4343d2bb0ad9..606b27150bae 100644 --- a/compiler/src/dotty/tools/dotc/core/Decorators.scala +++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala @@ -3,7 +3,7 @@ package core import annotation.tailrec import Symbols._ -import Contexts._, Names._, Phases._, printing.Texts._, printing.Printer, printing.Showable +import Contexts._, Names._, Phases._, printing.Texts._, printing.Printer import util.Positions.Position, util.SourcePosition import collection.mutable.ListBuffer import dotty.tools.dotc.transform.MegaPhase diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index d43611c53f52..d84c5b41579f 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -2,13 +2,11 @@ package dotty.tools package dotc package core -import Types._, Contexts._, Symbols._, Denotations._, SymDenotations._, StdNames._, Names._ -import Flags._, Scopes._, Decorators._, NameOps._, util.Positions._, Periods._ +import Types._, Contexts._, Symbols._, SymDenotations._, StdNames._, Names._ +import Flags._, Scopes._, Decorators._, NameOps._, Periods._ import unpickleScala2.Scala2Unpickler.ensureConstructor -import scala.collection.{ mutable, immutable } -import PartialFunction._ +import scala.collection.mutable import collection.mutable -import util.common.alwaysZero object Definitions { diff --git a/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala b/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala index 5ec1620a77f1..af4f94421450 100644 --- a/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala +++ b/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala @@ -8,8 +8,6 @@ import Types._ import Symbols._ import Denotations._ import Phases._ -import java.lang.AssertionError -import dotty.tools.dotc.util.DotClass object DenotTransformers { diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala index 2100db069eb0..7146b98e2041 100644 --- a/compiler/src/dotty/tools/dotc/core/Denotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala @@ -5,7 +5,6 @@ package core import SymDenotations.{ SymDenotation, ClassDenotation, NoDenotation } import Contexts.{Context, ContextBase} import Names._ -import NameOps._ import NameKinds._ import StdNames._ import Symbols.NoSymbol @@ -15,14 +14,12 @@ import Periods._ import Flags._ import DenotTransformers._ import Decorators._ -import dotc.transform.Erasure import printing.Texts._ import printing.Printer import io.AbstractFile import config.Config import util.common._ import collection.mutable.ListBuffer -import Decorators.SymbolIteratorDecorator import SymDenotations.LazyType /** Denotations represent the meaning of symbols and named types. diff --git a/compiler/src/dotty/tools/dotc/core/NameKinds.scala b/compiler/src/dotty/tools/dotc/core/NameKinds.scala index 1d38aeb88f97..2f4c39e5ae2c 100644 --- a/compiler/src/dotty/tools/dotc/core/NameKinds.scala +++ b/compiler/src/dotty/tools/dotc/core/NameKinds.scala @@ -5,9 +5,7 @@ package core import Names._ import NameOps._ import StdNames._ -import util.DotClass import NameTags._ -import Decorators._ import Contexts.Context import collection.mutable diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 3abd919f89d9..97488f09f4b6 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -2,14 +2,11 @@ package dotty.tools.dotc package core import java.security.MessageDigest -import scala.annotation.switch import scala.io.Codec import Names._, StdNames._, Contexts._, Symbols._, Flags._, NameKinds._ -import Decorators.PreNamedString -import util.{Chars, NameTransformer} +import util.Chars import Chars.isOperatorPart import Definitions._ -import config.Config object NameOps { diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala index e2e5a9e60ab4..e66730646b05 100644 --- a/compiler/src/dotty/tools/dotc/core/Names.scala +++ b/compiler/src/dotty/tools/dotc/core/Names.scala @@ -6,13 +6,9 @@ import scala.io.Codec import util.NameTransformer import printing.{Showable, Texts, Printer} import Texts.Text -import Decorators._ -import Contexts.Context import StdNames.str import util.Chars.isIdentifierStart -import collection.IndexedSeqOptimized import collection.immutable -import util.{DotClass} import config.Config import java.util.HashMap diff --git a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala index 6d834b864131..9e8c3bd320fe 100644 --- a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala +++ b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala @@ -5,10 +5,9 @@ package core import Types._, Contexts._, Symbols._, Decorators._ import util.SimpleIdentityMap import collection.mutable -import printing.{Printer, Showable} +import printing.Printer import printing.Texts._ import config.Config -import collection.immutable.BitSet import reflect.ClassTag import annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/core/Periods.scala b/compiler/src/dotty/tools/dotc/core/Periods.scala index 381593246495..7b0094a6ad41 100644 --- a/compiler/src/dotty/tools/dotc/core/Periods.scala +++ b/compiler/src/dotty/tools/dotc/core/Periods.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc.core import Contexts._ -import dotty.tools.dotc.util.DotClass /** Periods are the central "clock" of the compiler. * A period consists of a run id and a phase id. diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index 0269c6f536ee..b28c05805104 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -5,13 +5,11 @@ package core import Periods._ import Contexts._ import dotty.tools.backend.jvm.{LabelDefs, GenBCode} -import dotty.tools.dotc.core.Symbols.ClassSymbol -import util.DotClass import DenotTransformers._ import Denotations._ import Decorators._ import config.Printers.config -import scala.collection.mutable.{ListBuffer, ArrayBuffer} +import scala.collection.mutable.ListBuffer import dotty.tools.dotc.transform.MegaPhase._ import dotty.tools.dotc.transform._ import Periods._ diff --git a/compiler/src/dotty/tools/dotc/core/Scopes.scala b/compiler/src/dotty/tools/dotc/core/Scopes.scala index d4d6f6d734de..9b8abd4df1e9 100644 --- a/compiler/src/dotty/tools/dotc/core/Scopes.scala +++ b/compiler/src/dotty/tools/dotc/core/Scopes.scala @@ -11,15 +11,12 @@ import Symbols._ import Types.{TermRef, NoPrefix} import Flags.Implicit import Names._ -import Periods._ -import Decorators._ import Contexts._ import Denotations._ import SymDenotations._ import printing.Texts._ import printing.Printer import util.common._ -import util.DotClass import SymDenotations.NoDenotation import collection.mutable diff --git a/compiler/src/dotty/tools/dotc/core/StdNames.scala b/compiler/src/dotty/tools/dotc/core/StdNames.scala index 03c3f49ff94a..6a6a43aef3b9 100644 --- a/compiler/src/dotty/tools/dotc/core/StdNames.scala +++ b/compiler/src/dotty/tools/dotc/core/StdNames.scala @@ -2,13 +2,11 @@ package dotty.tools.dotc package core import scala.language.implicitConversions -import scala.collection.{mutable, immutable} +import scala.collection.mutable import scala.annotation.switch import Names._ import Symbols._ import Contexts._ -import Decorators.PreNamedString -import util.NameTransformer object StdNames { diff --git a/compiler/src/dotty/tools/dotc/core/Substituters.scala b/compiler/src/dotty/tools/dotc/core/Substituters.scala index 9b366d22b804..ebe62ecf840c 100644 --- a/compiler/src/dotty/tools/dotc/core/Substituters.scala +++ b/compiler/src/dotty/tools/dotc/core/Substituters.scala @@ -1,6 +1,6 @@ package dotty.tools.dotc.core -import Types._, Symbols._, Contexts._, Names._ +import Types._, Symbols._, Contexts._ /** Substitution operations on types. See the corresponding `subst` and * `substThis` methods on class Type for an explanation. diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 28caa658d24e..5551535932b0 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -3,23 +3,18 @@ package dotc package core import Periods._, Contexts._, Symbols._, Denotations._, Names._, NameOps._, Annotations._ -import Types._, Flags._, Decorators._, DenotTransformers._, StdNames._, Scopes._, Comments._ +import Types._, Flags._, Decorators._, DenotTransformers._, StdNames._, Scopes._ import NameOps._, NameKinds._, Phases._ import TypeApplications.TypeParamInfo import Scopes.Scope -import collection.mutable -import collection.BitSet import dotty.tools.io.AbstractFile import Decorators.SymbolIteratorDecorator import ast._ -import ast.Trees._ import annotation.tailrec -import CheckRealizable._ import util.SimpleIdentityMap import util.Stats import java.util.WeakHashMap import config.Config -import config.Printers.noPrinter import reporting.diagnostic.Message import reporting.diagnostic.messages.BadSymbolicReference import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala index f0aed548d984..9923e7f5deb5 100644 --- a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -6,16 +6,14 @@ import java.io.{IOException, File} import scala.compat.Platform.currentTime import dotty.tools.io.{ ClassPath, ClassRepresentation, AbstractFile } import config.Config -import classpath._ -import Contexts._, Symbols._, Flags._, SymDenotations._, Types._, Scopes._, util.Positions._, Names._ -import StdNames._, NameOps._ +import Contexts._, Symbols._, Flags._, SymDenotations._, Types._, Scopes._, Names._ +import NameOps._ import Decorators.{PreNamedString, StringInterpolators} import classfile.ClassfileParser import util.Stats import Decorators._ import scala.util.control.NonFatal import ast.Trees._ -import ast.tpd import parsing.JavaParsers.OutlineJavaParser import parsing.Parsers.OutlineParser import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index 9bdfa4e5236d..18ac831f3684 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -6,7 +6,6 @@ import Periods._ import Names._ import Scopes._ import Flags._ -import java.lang.AssertionError import Decorators._ import Symbols._ import Contexts._ @@ -14,7 +13,6 @@ import SymDenotations._ import printing.Texts._ import printing.Printer import Types._ -import Annotations._ import util.Positions._ import DenotTransformers._ import StdNames._ @@ -25,11 +23,10 @@ import tpd.{Tree, TreeProvider, TreeOps} import ast.TreeTypeMap import Constants.Constant import reporting.diagnostic.Message -import Denotations.{ Denotation, SingleDenotation, MultiDenotation } import collection.mutable import io.AbstractFile import language.implicitConversions -import util.{NoSource, DotClass, Property} +import util.{NoSource, Property} import scala.collection.JavaConverters._ import scala.annotation.internal.sharable import config.Printers.typr diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala index e4bcea5ce191..4fbc971edef1 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala @@ -5,21 +5,12 @@ package core import Types._ import Contexts._ import Symbols._ -import SymDenotations.{LazyType, TypeParamsCompleter} +import SymDenotations.LazyType import Decorators._ import util.Stats._ -import util.common._ import Names._ import NameOps._ -import NameKinds._ -import Constants.Constant -import Flags._ -import StdNames.tpnme -import util.Positions.Position -import config.Printers.{core, typr} -import collection.mutable import dotty.tools.dotc.config.Config -import java.util.NoSuchElementException object TypeApplications { diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 38d164301cd2..cf3275e03bdb 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -4,11 +4,11 @@ package core import Types._, Contexts._, Symbols._, Flags._, Names._, NameOps._, Denotations._ import Decorators._ -import StdNames.{nme, tpnme} +import StdNames.nme import collection.mutable -import util.{Stats, DotClass} +import util.Stats import config.Config -import config.Printers.{typr, constr, subtyping, gadts, noPrinter} +import config.Printers.{constr, subtyping, gadts, noPrinter} import TypeErasure.{erasedLub, erasedGlb} import TypeApplications._ import Constants.Constant @@ -21,7 +21,7 @@ import reporting.trace */ class TypeComparer(initctx: Context) extends ConstraintHandling { import TypeComparer._ - implicit val ctx = initctx + implicit val ctx: _root_.dotty.tools.dotc.core.Contexts.Context = initctx val state = ctx.typerState import state.constraint diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 4063eddf4a55..da0bacf4f97a 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -2,13 +2,11 @@ package dotty.tools package dotc package core -import Symbols._, Types._, Contexts._, Flags._, Names._, StdNames._, Decorators._ +import Symbols._, Types._, Contexts._, Flags._, Names._, StdNames._ import Flags.JavaDefined -import NameOps._ import Uniques.unique import dotc.transform.ExplicitOuter._ import dotc.transform.ValueClasses._ -import util.DotClass import transform.TypeUtils._ import Definitions.MaxImplementedFunctionArity import scala.annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/core/TypeErrors.scala b/compiler/src/dotty/tools/dotc/core/TypeErrors.scala index bafa67943887..2de2a6585b7d 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErrors.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErrors.scala @@ -2,7 +2,6 @@ package dotty.tools package dotc package core -import util.common._ import Types._ import Symbols._ import Flags._ diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index a839fe3502c8..e1f7f383ac28 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -2,18 +2,12 @@ package dotty.tools package dotc package core -import Contexts._, Types._, Symbols._, Names._, Flags._, Scopes._ -import SymDenotations._, Denotations.SingleDenotation -import config.Printers.typr +import Contexts._, Types._, Symbols._, Names._, Flags._ +import SymDenotations._ import util.Positions._ -import NameOps._ import NameKinds.DepParamName import Decorators._ import StdNames._ -import Annotations._ -import annotation.tailrec -import config.Config -import util.Property import collection.mutable import ast.tpd._ import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index d176e5eddd99..775e63e2589d 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -3,16 +3,12 @@ package dotc package core import Types._ -import Flags._ import Contexts._ -import util.{SimpleIdentityMap, SimpleIdentitySet, DotClass} +import util.{SimpleIdentityMap, SimpleIdentitySet} import reporting._ -import printing.{Showable, Printer} -import printing.Texts._ import config.Config import collection.mutable import java.lang.ref.WeakReference -import Decorators._ import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index c4aebabf1329..6160f6ed18de 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -7,7 +7,7 @@ import Symbols._ import Flags._ import Names._ import StdNames._, NameOps._ -import NameKinds.{SkolemName, SignedName} +import NameKinds.SkolemName import Scopes._ import Constants._ import Contexts._ @@ -16,15 +16,12 @@ import SymDenotations._ import Decorators._ import Denotations._ import Periods._ -import util.Positions.{Position, NoPosition} import util.Stats._ -import util.{DotClass, SimpleIdentitySet} +import util.SimpleIdentitySet import reporting.diagnostic.Message import ast.tpd._ import ast.TreeTypeMap import printing.Texts._ -import ast.untpd -import dotty.tools.dotc.transform.Erasure import printing.Printer import Hashable._ import Uniques._ @@ -2971,7 +2968,6 @@ object Types { paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type) extends MethodOrPoly with TermLambda with NarrowCached { thisMethodType => - import MethodType._ type This = MethodType diff --git a/compiler/src/dotty/tools/dotc/core/Uniques.scala b/compiler/src/dotty/tools/dotc/core/Uniques.scala index f31dc4f389b8..1bb6db5baeec 100644 --- a/compiler/src/dotty/tools/dotc/core/Uniques.scala +++ b/compiler/src/dotty/tools/dotc/core/Uniques.scala @@ -1,7 +1,7 @@ package dotty.tools.dotc package core -import Types._, Symbols._, Contexts._, util.Stats._, Hashable._, Names._ +import Types._, Contexts._, util.Stats._, Hashable._, Names._ import config.Config import Decorators._ import util.HashSet diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 4c908c712941..da07c9a2b17e 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -18,7 +18,7 @@ import scala.collection.immutable import scala.collection.mutable.{ ListBuffer, ArrayBuffer } import scala.annotation.switch import typer.Checking.checkNonCyclic -import io.{AbstractFile, PlainFile, Path, ZipArchive, JarArchive} +import io.{AbstractFile, PlainFile, ZipArchive} import scala.util.control.NonFatal object ClassfileParser { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala index 7d4e48cbcd18..749d1f893991 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc.core.tasty import dotty.tools.dotc.core.Comments.Comment -import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.core.tasty.TastyBuffer.Addr import dotty.tools.dotc.util.Positions.Position diff --git a/compiler/src/dotty/tools/dotc/core/tasty/DottyUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/DottyUnpickler.scala index 1c9acee3ba39..00489771e688 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/DottyUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/DottyUnpickler.scala @@ -3,12 +3,9 @@ package dotc package core package tasty -import Contexts._, SymDenotations._, Symbols._, Decorators._ +import Contexts._, SymDenotations._, Decorators._ import dotty.tools.dotc.ast.tpd -import TastyUnpickler._, TastyBuffer._ -import util.Positions._ -import util.{SourceFile, NoSource} -import Annotations.Annotation +import TastyUnpickler._ import classfile.ClassfileParser import Names.SimpleName import TreeUnpickler.UnpickleMode diff --git a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala index df83b8d50573..edab7045095a 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala @@ -5,12 +5,10 @@ package tasty import collection.mutable import Names.{Name, chrs, SimpleName, DerivedName} -import NameOps.NameDecorator import NameKinds._ import Decorators._ import TastyBuffer._ import scala.io.Codec -import TastyFormat._ class NameBuffer extends TastyBuffer(10000) { import NameBuffer._ diff --git a/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala index c3aa124928ae..16dbccfdffda 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala @@ -6,9 +6,8 @@ package tasty import ast._ import ast.Trees._ import ast.Trees.WithLazyField -import TastyFormat._ import core._ -import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._ +import Contexts._, Symbols._, Annotations._ import collection.mutable import TastyBuffer._ import util.Positions._ @@ -16,7 +15,6 @@ import util.Positions._ class PositionPickler(pickler: TastyPickler, addrOfTree: untpd.Tree => Option[Addr]) { val buf = new TastyBuffer(5000) pickler.newSection("Positions", buf) - import buf._ import ast.tpd._ private val pickledIndices = new mutable.BitSet diff --git a/compiler/src/dotty/tools/dotc/core/tasty/PositionUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/PositionUnpickler.scala index cbe213d89aae..a40e25bb6274 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/PositionUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/PositionUnpickler.scala @@ -6,7 +6,7 @@ package tasty import util.Positions._ import collection.mutable -import TastyBuffer.{Addr, NoAddr} +import TastyBuffer.Addr /** Unpickler for tree positions */ class PositionUnpickler(reader: TastyReader) { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala index 65724cfd8142..953c5e9de5af 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala @@ -3,13 +3,10 @@ package core package tasty import Contexts._, Decorators._ -import printing.Texts._ import Names.Name -import StdNames._ import TastyUnpickler._ -import TastyBuffer.{Addr, NameRef} -import util.Positions.{Position, offsetToInt} -import collection.mutable +import TastyBuffer.NameRef +import util.Positions.offsetToInt import printing.Highlighting._ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala index 94dd7f4b8120..4f38d10f47c7 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala @@ -3,12 +3,10 @@ package core package tasty import scala.collection.mutable -import TastyFormat._ import TastyFormat.NameTags._ import TastyBuffer.NameRef -import Names.{Name, TermName, termName, EmptyTermName} +import Names.{TermName, termName, EmptyTermName} import NameKinds._ -import java.util.UUID object TastyUnpickler { class UnpickleException(msg: String) extends RuntimeException(msg) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index d2431cfb01f2..757c12afdd66 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -4,19 +4,16 @@ package core package tasty import ast.Trees._ -import ast.{untpd, tpd, desugar} +import ast.{untpd, tpd} import TastyFormat._ -import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._, StdNames.tpnme, NameOps._ -import collection.mutable +import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._ import typer.Inliner -import NameOps._, NameKinds._ +import NameKinds._ import StdNames.nme import TastyBuffer._ -import TypeApplications._ import transform.SymUtils._ import printing.Printer import printing.Texts._ -import config.Config object TreePickler { diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 3058fdcf929c..cb7ebb4164c0 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -5,7 +5,7 @@ package tasty import Comments.CommentsContext import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, NameOps._ -import StdNames._, Denotations._, Flags._, Constants._, Annotations._ +import StdNames._, Flags._, Constants._, Annotations._ import NameKinds._ import typer.Checking.checkNonCyclic import util.Positions._ @@ -13,13 +13,11 @@ import ast.{tpd, untpd, Trees} import Trees._ import Decorators._ import transform.SymUtils._ -import TastyUnpickler._, TastyBuffer._ +import TastyBuffer._ import scala.annotation.{tailrec, switch} import scala.collection.mutable.ListBuffer -import scala.collection.{ mutable, immutable } +import scala.collection.mutable import config.Printers.pickling -import typer.Checking -import config.Config import core.quoted.PickledQuotes import scala.quoted import scala.quoted.Types.TreeType diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Flags.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Flags.scala index 97480e49ff4a..5025a7a54997 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Flags.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Flags.scala @@ -8,7 +8,6 @@ package dotc package core package unpickleScala2 -import scala.collection.{ mutable, immutable } /** Scala2 flags, adapted from https://github.com/scala/scala/blob/2.11.x/src/reflect/scala/reflect/internal/Flags.scala */ diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 24d7606c2b9b..dd55c3b1bf0e 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -10,9 +10,8 @@ import java.lang.Double.longBitsToDouble import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, NameOps._ import StdNames._, Denotations._, NameOps._, Flags._, Constants._, Annotations._ import NameKinds.{Scala2MethodNameKinds, SuperAccessorName, ExpandedName} -import dotty.tools.dotc.typer.ProtoTypes.{FunProtoTyped, FunProto} import util.Positions._ -import dotty.tools.dotc.ast.{tpd, Trees, untpd}, ast.tpd._ +import dotty.tools.dotc.ast.{tpd, untpd}, ast.tpd._ import ast.untpd.Modifiers import printing.Texts._ import printing.Printer @@ -25,7 +24,7 @@ import PickleFormat._ import Decorators._ import TypeApplications._ import classfile.ClassfileParser -import scala.collection.{ mutable, immutable } +import scala.collection.mutable import scala.collection.mutable.ListBuffer import scala.annotation.switch import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala index 14905bdc9d88..6bed8e30c2df 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala @@ -6,9 +6,8 @@ import java.io.{OutputStream, PrintStream} import dotty.tools.dotc.core.Contexts._ import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.core.tasty.TastyPrinter -import dotty.tools.dotc.printing.DecompilerPrinter import dotty.tools.dotc.tastyreflect.TastyImpl -import dotty.tools.io.{File, Path} +import dotty.tools.io.File /** Phase that prints the trees in all loaded compilation units. * diff --git a/compiler/src/dotty/tools/dotc/decompiler/Main.scala b/compiler/src/dotty/tools/dotc/decompiler/Main.scala index 61e7e8654e54..dd7cd8d00b15 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/Main.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/Main.scala @@ -1,6 +1,6 @@ package dotty.tools.dotc.decompiler -import java.nio.file.{Files, Paths} +import java.nio.file.Files import dotty.tools.dotc import dotty.tools.dotc.core.Contexts._ diff --git a/compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala b/compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala index 01197e8c1698..ec7281da592e 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala @@ -6,14 +6,10 @@ import core._ import Decorators._ import Contexts.Context import Symbols.{Symbol, ClassSymbol} -import SymDenotations.{SymDenotation, ClassDenotation, LazyType} +import SymDenotations.ClassDenotation import typer.FrontEnd -import Names.TypeName import NameOps._ -import Types.Type -import ast.tpd import ast.Trees.Tree -import util.SourceFile import CompilationUnit.mkCompilationUnit class ReadTastyTreesFromClasses extends FrontEnd { diff --git a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala index 9c091ad5e2b2..2c5fe5d5cace 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala @@ -7,7 +7,7 @@ import scala.collection._ import ast.{NavigateAST, Trees, tpd, untpd} import core._, core.Decorators.{sourcePos => _, _} -import Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._ +import Contexts._, Flags._, Names._, NameOps._, Symbols._, Trees._, Types._ import util.Positions._, util.SourcePosition import core.Denotations.SingleDenotation import NameKinds.SimpleNameKind @@ -367,7 +367,6 @@ object Interactive { case Nil | _ :: Nil => ctx.run.runContext.fresh.setCompilationUnit(ctx.compilationUnit) case nested :: encl :: rest => - import typer.Typer._ val outer = contextOfPath(encl :: rest) try encl match { case tree @ PackageDef(pkg, stats) => diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveCompiler.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveCompiler.scala index 661d0bc686aa..2fdc2fc657b5 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveCompiler.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveCompiler.scala @@ -5,7 +5,6 @@ package interactive import core._ import Phases._ import typer._ -import Contexts._ class InteractiveCompiler extends Compiler { // TODO: Figure out what phases should be run in IDEs diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala index e7f432107829..8c24cbe6e7c4 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala @@ -6,19 +6,16 @@ import java.net.URI import java.io._ import java.nio.file._ import java.nio.file.attribute.BasicFileAttributes -import java.util.stream._ import java.util.zip._ -import java.util.function._ import scala.collection._ -import JavaConverters._ import scala.io.Codec import dotty.tools.io.{ ClassPath, ClassRepresentation, PlainFile, VirtualFile } import ast.{Trees, tpd} import core._, core.Decorators._ -import Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._ +import Contexts._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._ import classpath._ import reporting._, reporting.diagnostic.MessageContainer import util._ @@ -26,7 +23,6 @@ import util._ /** A Driver subclass designed to be used from IDEs */ class InteractiveDriver(val settings: List[String]) extends Driver { import tpd._ - import InteractiveDriver._ override def sourcesRequired = false diff --git a/compiler/src/dotty/tools/dotc/interactive/SourceTree.scala b/compiler/src/dotty/tools/dotc/interactive/SourceTree.scala index 37c033aa68e9..2e0978085504 100644 --- a/compiler/src/dotty/tools/dotc/interactive/SourceTree.scala +++ b/compiler/src/dotty/tools/dotc/interactive/SourceTree.scala @@ -5,7 +5,7 @@ package interactive import scala.io.Codec import ast.tpd -import core._, core.Decorators.{sourcePos => _, _} +import core._, core.Decorators.{sourcePos => _} import Contexts._, NameOps._, Symbols._, StdNames._ import util._, util.Positions._ diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala index f22afb941c73..e4932f545001 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -6,7 +6,6 @@ import dotty.tools.dotc.core.Constants.Constant import dotty.tools.dotc.core.Flags import dotty.tools.dotc.core.Flags.FlagSet -import scala.language.implicitConversions import JavaTokens._ import JavaScanners._ @@ -15,7 +14,6 @@ import Parsers._ import core._ import Contexts._ import Names._ -import NameOps._ import Types._ import Symbols._ import ast.Trees._ @@ -24,7 +22,6 @@ import StdNames._ import dotty.tools.dotc.reporting.diagnostic.messages.IdentifierExpected import dotty.tools.dotc.util.SourceFile import util.Positions._ -import annotation.switch import scala.collection.mutable.ListBuffer object JavaParsers { diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala b/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala index 09ce8a9a38bc..0af216e5d9c3 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala @@ -2,7 +2,7 @@ package dotty.tools package dotc package parsing -import core.Names._, core.Contexts._, core.Decorators._, util.Positions._ +import core.Contexts._ import Scanners._ import util.SourceFile import JavaTokens._ diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 0b67a9e0668d..24376d0d6d35 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -16,14 +16,11 @@ import Names._ import NameKinds.WildcardParamName import ast.{Positioned, Trees, untpd} import ast.Trees._ -import Decorators._ import StdNames._ import util.Positions._ import Constants._ import ScriptParsers._ -import Comments._ import scala.annotation.{tailrec, switch} -import util.DotClass import rewrites.Rewrites.patch object Parsers { diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 415c6904eb6c..132b302ba5d3 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -10,9 +10,7 @@ import util.Chars._ import util.NameTransformer.avoidIllegalChars import Tokens._ import scala.annotation.{ switch, tailrec } -import scala.collection.mutable import scala.collection.immutable.SortedMap -import mutable.ListBuffer import rewrites.Rewrites.patch object Scanners { diff --git a/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala b/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala index 663cd48203c2..fdd8fc647364 100644 --- a/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala +++ b/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala @@ -11,7 +11,6 @@ import Names._, StdNames._, ast.Trees._, ast.{tpd, untpd} import Symbols._, Contexts._ import util.Positions._ import Parsers.Parser -import scala.language.implicitConversions /** This class builds instance of `Tree` that represent XML. * diff --git a/compiler/src/dotty/tools/dotc/plugins/Plugins.scala b/compiler/src/dotty/tools/dotc/plugins/Plugins.scala index 1b19df3068aa..734208ce51be 100644 --- a/compiler/src/dotty/tools/dotc/plugins/Plugins.scala +++ b/compiler/src/dotty/tools/dotc/plugins/Plugins.scala @@ -8,7 +8,6 @@ import dotty.tools.io._ import Phases._ import config.Printers.plugins.{ println => debug } -import scala.collection.mutable.ListBuffer /** Support for run-time loading of compiler plugins. * diff --git a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala index fe03355800e5..7d1ebde30bdf 100644 --- a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala @@ -10,7 +10,6 @@ import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.core.StdNames._ -import scala.language.implicitConversions class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) { diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala index e8090ddede13..1c4d9c3e1283 100644 --- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala +++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala @@ -2,16 +2,13 @@ package dotty.tools.dotc package printing import core._ -import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Contexts._ +import Texts._, Types._, Flags._, Symbols._, Contexts._ import collection.mutable -import collection.Map import Decorators._ -import scala.annotation.switch import scala.util.control.NonFatal import reporting.diagnostic.MessageContainer import util.DiffUtil import Highlighting._ -import SyntaxHighlighting._ object Formatting { diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 19ed444e5e7a..592c5e647a43 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -4,11 +4,10 @@ package printing import core._ import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Constants._, Denotations._ import Contexts.Context, Scopes.Scope, Denotations.Denotation, Annotations.Annotation -import StdNames.{nme, tpnme} -import ast.Trees._, ast._ +import StdNames.nme +import ast.Trees._ import typer.Implicits._ import typer.ImportInfo -import config.Config import java.lang.Integer.toOctalString import config.Config.summarizeDepth import scala.util.control.NonFatal diff --git a/compiler/src/dotty/tools/dotc/printing/Printer.scala b/compiler/src/dotty/tools/dotc/printing/Printer.scala index 8e72a8a5e477..f52de2d30598 100644 --- a/compiler/src/dotty/tools/dotc/printing/Printer.scala +++ b/compiler/src/dotty/tools/dotc/printing/Printer.scala @@ -4,7 +4,7 @@ package printing import core._ import Texts._, ast.Trees._ -import Types.Type, Symbols.Symbol, Contexts.Context, Scopes.Scope, Constants.Constant, +import Types.Type, Symbols.Symbol, Scopes.Scope, Constants.Constant, Names.Name, Denotations._, Annotations.Annotation import typer.Implicits.SearchResult import typer.ImportInfo diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index b0c3a42abcc0..e81ae4e6f3d4 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -8,30 +8,21 @@ import Flags._ import Names._ import Symbols._ import NameOps._ -import Constants._ import TypeErasure.ErasedValueType import Contexts.Context -import Scopes.Scope import Denotations._ import SymDenotations._ -import Annotations.Annotation import StdNames.{nme, tpnme} -import ast.{Trees, tpd, untpd} -import typer.{Implicits, Inliner, Namer} +import ast.{Trees, untpd} +import typer.{Implicits, Namer} import typer.ProtoTypes._ import Trees._ import TypeApplications._ import Decorators._ -import config.Config -import util.Positions._ -import transform.SymUtils._ import transform.TypeUtils._ -import dotty.tools.dotc.transform.FirstTransform -import scala.annotation.switch import language.implicitConversions import dotty.tools.dotc.util.SourcePosition -import Highlighting._ import dotty.tools.dotc.ast.untpd.{MemberDef, Modifiers, PackageDef, RefTree, Template, TypeDef, ValOrDefDef} class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { @@ -660,7 +651,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { (txt /: vparamss)((txt, vparams) => txt ~ "(" ~ toText(vparams, ", ") ~ ")") protected def valDefToText[T >: Untyped](tree: ValDef[T]): Text = { - import untpd.{modsDeco => _, _} + import untpd.{modsDeco => _} dclTextOr(tree) { modText(tree.mods, tree.symbol, keywordStr(if (tree.mods is Mutable) "var" else "val")) ~~ valDefText(nameIdText(tree)) ~ optAscription(tree.tpt) ~ @@ -669,7 +660,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { } protected def defDefToText[T >: Untyped](tree: DefDef[T]): Text = { - import untpd.{modsDeco => _, _} + import untpd.{modsDeco => _} dclTextOr(tree) { val prefix = modText(tree.mods, tree.symbol, keywordStr("def")) ~~ valDefText(nameIdText(tree)) withEnclosingDef(tree) { diff --git a/compiler/src/dotty/tools/dotc/printing/ReplPrinter.scala b/compiler/src/dotty/tools/dotc/printing/ReplPrinter.scala index 700bc8bcccb4..a66555423e64 100644 --- a/compiler/src/dotty/tools/dotc/printing/ReplPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/ReplPrinter.scala @@ -7,10 +7,9 @@ import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.NameOps._ import dotty.tools.dotc.core.Names.Name import dotty.tools.dotc.core.Symbols._ -import dotty.tools.dotc.core.Types.{ExprType, TypeAlias} +import dotty.tools.dotc.core.Types.ExprType import dotty.tools.dotc.printing.Texts._ -import scala.language.implicitConversions class ReplPrinter(_ctx: Context) extends DecompilerPrinter(_ctx) { diff --git a/compiler/src/dotty/tools/dotc/printing/Showable.scala b/compiler/src/dotty/tools/dotc/printing/Showable.scala index efddb26f7f13..550d80060a15 100644 --- a/compiler/src/dotty/tools/dotc/printing/Showable.scala +++ b/compiler/src/dotty/tools/dotc/printing/Showable.scala @@ -5,7 +5,6 @@ import core._ import Contexts._, Texts._, Decorators._ import config.Config.summarizeDepth -import scala.util.control.NonFatal trait Showable extends Any { diff --git a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala index 128a28b744fa..1919b992c2db 100644 --- a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala +++ b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala @@ -7,7 +7,6 @@ import dotty.tools.dotc.parsing.Parsers.Parser import dotty.tools.dotc.parsing.Scanners.Scanner import dotty.tools.dotc.parsing.Tokens._ import dotty.tools.dotc.reporting.Reporter -import dotty.tools.dotc.reporting.diagnostic.MessageContainer import dotty.tools.dotc.util.Positions.Position import dotty.tools.dotc.util.SourceFile diff --git a/compiler/src/dotty/tools/dotc/printing/package.scala b/compiler/src/dotty/tools/dotc/printing/package.scala index 80dfb5244d97..9ad42d5b5612 100644 --- a/compiler/src/dotty/tools/dotc/printing/package.scala +++ b/compiler/src/dotty/tools/dotc/printing/package.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc import core.StdNames.{nme,tpnme} -import parsing.{precedence, minPrec, maxPrec, minInfixPrec} import util.Property.Key package object printing { diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala index a54cf8a3bd67..bc8a9796aa0e 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc package quoted -import dotty.tools.backend.jvm.GenBCode import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Decorators._ @@ -18,7 +17,7 @@ import dotty.tools.dotc.transform.ReifyQuotes import dotty.tools.dotc.typer.FrontEnd import dotty.tools.dotc.util.Positions.Position import dotty.tools.dotc.util.SourceFile -import dotty.tools.io.{AbstractFile, Path, PlainFile} +import dotty.tools.io.{Path, PlainFile} import scala.quoted.{Expr, Type} @@ -26,7 +25,6 @@ import scala.quoted.{Expr, Type} * a class file with `class ' { def apply: Object = expr }`. */ class QuoteCompiler extends Compiler { - import tpd._ override protected def frontendPhases: List[List[Phase]] = List(List(new QuotedFrontend(putInClass = true))) diff --git a/compiler/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/compiler/src/dotty/tools/dotc/reporting/ConsoleReporter.scala index eb40cab959a2..4d775eaa3bc5 100644 --- a/compiler/src/dotty/tools/dotc/reporting/ConsoleReporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/ConsoleReporter.scala @@ -4,8 +4,8 @@ package reporting import core.Contexts._ import java.io.{ BufferedReader, PrintWriter } -import diagnostic.{ Message, MessageContainer } -import diagnostic.messages.{ Error, Warning, ConditionalWarning } +import diagnostic.MessageContainer +import diagnostic.messages.{ Error, ConditionalWarning } /** * This class implements a Reporter that displays messages on a text console diff --git a/compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala b/compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala index 0cdf717c6f2f..85db42421550 100644 --- a/compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala +++ b/compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala @@ -6,7 +6,7 @@ import core.Contexts.Context import core.Decorators._ import printing.Highlighting.{Blue, Red} import printing.SyntaxHighlighting -import diagnostic.{ErrorMessageID, Message, MessageContainer, NoExplanation} +import diagnostic.{ErrorMessageID, Message, MessageContainer} import diagnostic.messages._ import util.SourcePosition import util.Chars.{ LF, CR, FF, SU } diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 4e556af7ea5c..388326aa980c 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -33,7 +33,6 @@ object Reporter { } } -import Reporter._ trait Reporting { this: Context => diff --git a/compiler/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/compiler/src/dotty/tools/dotc/reporting/ThrowingReporter.scala index d8e03ab66ab8..758cc3733ad1 100644 --- a/compiler/src/dotty/tools/dotc/reporting/ThrowingReporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/ThrowingReporter.scala @@ -3,10 +3,8 @@ package dotc package reporting import core.Contexts.Context -import collection.mutable import diagnostic.MessageContainer import diagnostic.messages.Error -import Reporter._ /** * This class implements a Reporter that throws all errors and sends warnings and other diff --git a/compiler/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala b/compiler/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala index b7049f8038b6..4a69f4f6fd56 100644 --- a/compiler/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala +++ b/compiler/src/dotty/tools/dotc/reporting/UniqueMessagePositions.scala @@ -3,7 +3,7 @@ package dotc package reporting import scala.collection.mutable -import util.{SourcePosition, SourceFile} +import util.SourceFile import core.Contexts.Context import diagnostic.MessageContainer diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/Message.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/Message.scala index 74b4e1fe0194..d223fa836002 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/Message.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/Message.scala @@ -4,7 +4,6 @@ package reporting package diagnostic import util.SourcePosition -import core.Contexts.Context import messages._ diff --git a/compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala b/compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala index b4cc9c8a192c..6cc500c367f6 100644 --- a/compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala +++ b/compiler/src/dotty/tools/dotc/rewrites/Rewrites.scala @@ -3,7 +3,7 @@ package rewrites import util.{SourceFile, Positions} import Positions.Position -import core.Contexts.{Context, FreshContext} +import core.Contexts.Context import collection.mutable import scala.annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/CaseDefOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/CaseDefOpsImpl.scala index bf8c82239265..0ad6f123be72 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/CaseDefOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/CaseDefOpsImpl.scala @@ -1,6 +1,5 @@ package dotty.tools.dotc.tastyreflect -import dotty.tools.dotc.ast.tpd trait CaseDefOpsImpl extends scala.tasty.reflect.CaseDefOps with TastyCoreImpl with Helpers { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ConstantOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ConstantOpsImpl.scala index 179e40a53c79..fdb4e5472580 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ConstantOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ConstantOpsImpl.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc.tastyreflect import dotty.tools.dotc.core.Constants -import scala.tasty.util.Show trait ConstantOpsImpl extends scala.tasty.reflect.ConstantOps with TastyCoreImpl { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ContextOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ContextOpsImpl.scala index c794f39b5e1f..821003edeac1 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ContextOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ContextOpsImpl.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc.tastyreflect import dotty.tools.dotc.core.Contexts -import dotty.tools.dotc.tastyreflect.FromSymbol.definitionFromSym import dotty.tools.dotc.util.{Positions, SourcePosition} trait ContextOpsImpl extends scala.tasty.reflect.ContextOps with TastyCoreImpl { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/PatternOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/PatternOpsImpl.scala index 0eed6293b3f5..e2e29790805a 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/PatternOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/PatternOpsImpl.scala @@ -4,7 +4,6 @@ import dotty.tools.dotc.ast.{Trees, tpd} import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.core.Types -import scala.tasty.util.Show trait PatternOpsImpl extends scala.tasty.reflect.PatternOps with TastyCoreImpl { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/StandardDefinitions.scala b/compiler/src/dotty/tools/dotc/tastyreflect/StandardDefinitions.scala index 8a73c60d67b4..f8597b71d79e 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/StandardDefinitions.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/StandardDefinitions.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc.tastyreflect import dotty.tools.dotc.core.Symbols._ -import dotty.tools.dotc.tastyreflect.FromSymbol._ trait StandardDefinitions extends scala.tasty.reflect.StandardDefinitions { tasty: TastyImpl => diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/TreeOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/TreeOpsImpl.scala index 75d7712f591b..0ee41247c12c 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/TreeOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/TreeOpsImpl.scala @@ -3,7 +3,6 @@ package dotty.tools.dotc.tastyreflect import dotty.tools.dotc.ast.{Trees, tpd} import dotty.tools.dotc.core import dotty.tools.dotc.core.Decorators._ -import dotty.tools.dotc.core.StdNames.nme import dotty.tools.dotc.core._ import dotty.tools.dotc.tastyreflect.FromSymbol.{definitionFromSym, packageDefFromSym} diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsOpsImpl.scala index 6fdffc033137..3318435ea524 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsOpsImpl.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc.tastyreflect -import dotty.tools.dotc.core.Symbols.Symbol import dotty.tools.dotc.core.{Names, Types} -import dotty.tools.dotc.tastyreflect.FromSymbol.definitionFromSym trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with TastyCoreImpl { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsTreesOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsTreesOpsImpl.scala index 7381cba384eb..86c87c6ccb1f 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsTreesOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/TypeOrBoundsTreesOpsImpl.scala @@ -5,7 +5,6 @@ import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.core.StdNames.nme import dotty.tools.dotc.core.Types -import scala.tasty.util.Show trait TypeOrBoundsTreesOpsImpl extends scala.tasty.reflect.TypeOrBoundsTreeOps with TastyCoreImpl { diff --git a/compiler/src/dotty/tools/dotc/transform/AccessProxies.scala b/compiler/src/dotty/tools/dotc/transform/AccessProxies.scala index 1e4bd8730559..ee736cc705e0 100644 --- a/compiler/src/dotty/tools/dotc/transform/AccessProxies.scala +++ b/compiler/src/dotty/tools/dotc/transform/AccessProxies.scala @@ -9,11 +9,9 @@ import Names._ import NameOps._ import Decorators._ import TypeUtils._ -import Annotations.Annotation import Types._ import NameKinds.ClassifiedNameKind import ast.Trees._ -import util.Property import util.Positions.Position import config.Printers.transforms diff --git a/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala b/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala index 00e2473d8ae1..b524d060d4a2 100644 --- a/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala +++ b/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala @@ -4,22 +4,12 @@ package transform import core._ import MegaPhase._ import Contexts.Context -import Flags._ -import SymUtils._ import Symbols._ -import SymDenotations._ import Types._ -import Decorators._ -import DenotTransformers._ import StdNames._ -import NameOps._ import ast.Trees._ import dotty.tools.dotc.ast.tpd -import util.Positions._ -import Names._ -import collection.mutable -import ResolveSuper._ import scala.collection.immutable.:: diff --git a/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala b/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala index c5011bdb716a..bd7343e1d6fd 100644 --- a/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala +++ b/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala @@ -7,7 +7,6 @@ import Contexts.Context import Flags._ import SymUtils._ import Symbols._ -import SymDenotations._ import Types._ import Decorators._ import DenotTransformers._ @@ -15,7 +14,6 @@ import Annotations._ import StdNames._ import NameOps._ import NameKinds.{ExpandedName, TraitSetterName} -import ast.Trees._ object AugmentScala2Traits { val name = "augmentScala2Traits" diff --git a/compiler/src/dotty/tools/dotc/transform/Bridges.scala b/compiler/src/dotty/tools/dotc/transform/Bridges.scala index 8e9c7436a96e..28a0d1240290 100644 --- a/compiler/src/dotty/tools/dotc/transform/Bridges.scala +++ b/compiler/src/dotty/tools/dotc/transform/Bridges.scala @@ -3,12 +3,10 @@ package dotc package transform import core._ -import Symbols._, Types._, Contexts._, Decorators._, SymDenotations._, Flags._, Scopes._ +import Symbols._, Types._, Contexts._, Decorators._, Flags._, Scopes._ import DenotTransformers._ import ast.untpd import collection.{mutable, immutable} -import TypeErasure._ -import ValueClasses.isDerivedValueClass import ShortcutImplicits._ /** A helper class for generating bridge methods in class `root`. */ diff --git a/compiler/src/dotty/tools/dotc/transform/ByNameClosures.scala b/compiler/src/dotty/tools/dotc/transform/ByNameClosures.scala index 919a1961f5fa..1b9c65a938cc 100644 --- a/compiler/src/dotty/tools/dotc/transform/ByNameClosures.scala +++ b/compiler/src/dotty/tools/dotc/transform/ByNameClosures.scala @@ -2,12 +2,9 @@ package dotty.tools.dotc package transform import core._ -import Symbols._ -import SymDenotations._ import Contexts._ import Types._ import Flags._ -import Decorators._ import DenotTransformers.IdentityDenotTransformer import core.StdNames.nme diff --git a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala index 3e1977ed5e1a..7c1071bc3363 100644 --- a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala +++ b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala @@ -5,19 +5,14 @@ import MegaPhase._ import core.DenotTransformers._ import core.Symbols._ import core.Contexts._ -import core.Types._ import core.Flags._ import core.Decorators._ -import core.SymDenotations._ import core.StdNames.nme import core.Names._ -import core.NameOps._ import core.NameKinds.TempResultName import ast.Trees._ -import SymUtils._ import util.Store -import collection.{ mutable, immutable } -import collection.mutable.{ LinkedHashMap, LinkedHashSet, TreeSet } +import collection.mutable /** This phase translates variables that are captured in closures to * heap-allocated refs. diff --git a/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala b/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala index 49be540f92ab..d0fa26444b1e 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckReentrant.scala @@ -2,24 +2,11 @@ package dotty.tools.dotc package transform import core._ -import Names._ import dotty.tools.dotc.transform.MegaPhase._ -import ast.Trees._ import Flags._ -import Types._ -import Constants.Constant import Contexts.Context import Symbols._ -import SymDenotations._ import Decorators._ -import dotty.tools.dotc.core.Annotations.ConcreteAnnotation -import dotty.tools.dotc.core.Denotations.SingleDenotation -import scala.collection.mutable -import DenotTransformers._ -import typer.Checking -import Names.Name -import NameOps._ -import StdNames._ /** A no-op transform that checks whether the compiled sources are re-entrant. diff --git a/compiler/src/dotty/tools/dotc/transform/ClassOf.scala b/compiler/src/dotty/tools/dotc/transform/ClassOf.scala index 493ff8df638d..4938d4a993d2 100644 --- a/compiler/src/dotty/tools/dotc/transform/ClassOf.scala +++ b/compiler/src/dotty/tools/dotc/transform/ClassOf.scala @@ -2,11 +2,8 @@ package dotty.tools.dotc package transform import ast.tpd -import core.Constants.Constant import core.Contexts.Context -import core.StdNames.nme -import core.Symbols.{defn,TermSymbol} -import core.TypeErasure +import core.Symbols.defn import MegaPhase._ /** Rewrite `classOf` calls as follow: diff --git a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala index 4b3ad0eb8255..eec133b0563f 100644 --- a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala +++ b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala @@ -2,20 +2,13 @@ package dotty.tools.dotc.transform import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context -import scala.collection.mutable.ListBuffer -import dotty.tools.dotc.core.{Scopes, Flags} -import dotty.tools.dotc.core.Symbols.NoSymbol -import scala.annotation.tailrec +import dotty.tools.dotc.core.Flags import dotty.tools.dotc.core._ import Symbols._ import dotty.tools.dotc.transform.MegaPhase._ import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context -import scala.collection.mutable -import dotty.tools.dotc.core.Names.Name -import NameOps._ import Types._ -import scala.collection.SortedSet import Decorators._ import StdNames._ import dotty.tools.dotc.util.Positions.Position diff --git a/compiler/src/dotty/tools/dotc/transform/CollectNullableFields.scala b/compiler/src/dotty/tools/dotc/transform/CollectNullableFields.scala index 201ae4e21def..103c80f20114 100644 --- a/compiler/src/dotty/tools/dotc/transform/CollectNullableFields.scala +++ b/compiler/src/dotty/tools/dotc/transform/CollectNullableFields.scala @@ -4,11 +4,9 @@ import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.Symbols.Symbol -import dotty.tools.dotc.core.Types.{Type, ExprType} import dotty.tools.dotc.transform.MegaPhase.MiniPhase import dotty.tools.dotc.transform.SymUtils._ -import scala.collection.JavaConverters._ import scala.collection.mutable import java.util.IdentityHashMap diff --git a/compiler/src/dotty/tools/dotc/transform/Constructors.scala b/compiler/src/dotty/tools/dotc/transform/Constructors.scala index 89a3d16772a4..426e8da250a1 100644 --- a/compiler/src/dotty/tools/dotc/transform/Constructors.scala +++ b/compiler/src/dotty/tools/dotc/transform/Constructors.scala @@ -6,17 +6,13 @@ import MegaPhase._ import dotty.tools.dotc.ast.tpd._ import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.StdNames._ -import Phases._ import ast._ import Trees._ import Flags._ import SymUtils._ import Symbols._ -import SymDenotations._ -import Types._ import Decorators._ import DenotTransformers._ -import util.Positions._ import Constants.Constant import collection.mutable diff --git a/compiler/src/dotty/tools/dotc/transform/CrossCastAnd.scala b/compiler/src/dotty/tools/dotc/transform/CrossCastAnd.scala index a50b8cb01e97..6b07073a886e 100644 --- a/compiler/src/dotty/tools/dotc/transform/CrossCastAnd.scala +++ b/compiler/src/dotty/tools/dotc/transform/CrossCastAnd.scala @@ -3,11 +3,10 @@ package dotty.tools.dotc.transform import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Flags -import dotty.tools.dotc.core.Types.{NoType, Type, AndType} +import dotty.tools.dotc.core.Types.AndType import dotty.tools.dotc.transform.MegaPhase._ import tpd._ -import scala.collection.mutable.ListBuffer /** diff --git a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala index ba1c572f45c6..476c29ce7b1b 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala @@ -1,17 +1,11 @@ package dotty.tools.dotc package transform -import MegaPhase._ import core._ import DenotTransformers.InfoTransformer import Symbols._ -import SymDenotations._ import Contexts._ import Types._ -import Flags._ -import Decorators._ -import SymUtils._ -import util.Attachment import core.StdNames.nme import ast.Trees._ diff --git a/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala b/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala index a9d2ef7cff14..d86d062809ab 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala @@ -3,9 +3,9 @@ package transform import ast.{Trees, tpd} import core._, core.Decorators._ -import MegaPhase._, Phases.Phase -import Types._, Contexts._, Constants._, Names._, NameOps._, Flags._, DenotTransformers._ -import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Scopes._, Denotations._ +import MegaPhase._ +import Types._, Contexts._, Flags._, DenotTransformers._ +import Symbols._, StdNames._, Trees._ import TypeErasure.ErasedValueType, ValueClasses._ object ElimErasedValueType { diff --git a/compiler/src/dotty/tools/dotc/transform/ElimOuterSelect.scala b/compiler/src/dotty/tools/dotc/transform/ElimOuterSelect.scala index 7bc8c696e1a0..e1f9724f3ba5 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimOuterSelect.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimOuterSelect.scala @@ -5,9 +5,7 @@ import core._ import MegaPhase.MiniPhase import Contexts.Context import Types._ -import Decorators._ import NameKinds.OuterSelectName -import ast.Trees._ /** This phase rewrites outer selects `E.n_` which were introduced by * inlining to outer paths. diff --git a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala index c94631e78d30..78068e62a39a 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc package transform import core._ -import Names._ import StdNames.nme import Types._ import dotty.tools.dotc.transform.MegaPhase._ @@ -13,14 +12,8 @@ import Symbols._ import Constants._ import Decorators._ import Denotations._, SymDenotations._ -import Decorators.StringInterpolators import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.core.Annotations.ConcreteAnnotation -import scala.collection.mutable import DenotTransformers._ -import Names.Name -import NameOps._ -import TypeUtils._ object ElimRepeated { val name = "elimRepeated" diff --git a/compiler/src/dotty/tools/dotc/transform/ElimStaticThis.scala b/compiler/src/dotty/tools/dotc/transform/ElimStaticThis.scala index 662e5d5c55bd..b7ac1a688be4 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimStaticThis.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimStaticThis.scala @@ -5,8 +5,6 @@ import core._ import Contexts.Context import Flags._ import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.core.StdNames._ -import dotty.tools.dotc.core.SymDenotations.SymDenotation import MegaPhase.MiniPhase import dotty.tools.dotc.core.Types.{ThisType, TermRef} diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala index e95f90348e03..cd0b751bf452 100644 --- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala +++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala @@ -18,12 +18,10 @@ import core.Definitions._ import typer.NoChecking import typer.Inliner import typer.ProtoTypes._ -import typer.ErrorReporting._ import core.TypeErasure._ import core.Decorators._ -import dotty.tools.dotc.ast.{Trees, tpd, untpd} +import dotty.tools.dotc.ast.{tpd, untpd} import ast.Trees._ -import scala.collection.mutable.ListBuffer import dotty.tools.dotc.core.{Constants, Flags} import ValueClasses._ import TypeUtils._ diff --git a/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala b/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala index 5a4084012945..76150bca32a5 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExpandPrivate.scala @@ -2,24 +2,18 @@ package dotty.tools.dotc package transform import core._ -import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.core.DenotTransformers.{IdentityDenotTransformer, SymTransformer} +import dotty.tools.dotc.core.DenotTransformers.IdentityDenotTransformer import Contexts.Context import Symbols._ -import Scopes._ import Flags._ -import StdNames._ import SymDenotations._ -import Types._ -import collection.mutable import Decorators._ import ast.Trees._ import MegaPhase._ import java.io.File.separatorChar import ValueClasses._ -import dotty.tools.dotc.core.Phases.Phase /** Make private term members that are accessed from another class * non-private by resetting the Private flag and expanding their name. diff --git a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala index 3cac673ae5b0..83707b308e65 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala @@ -3,10 +3,8 @@ package transform import core._ import Contexts._, Symbols._, Types._, Flags._, Decorators._, StdNames._, Constants._ -import SymDenotations.SymDenotation import MegaPhase._ import SymUtils._ -import ast.untpd import ast.Trees._ import dotty.tools.dotc.reporting.diagnostic.messages.TypeMismatch import dotty.tools.dotc.util.Positions.Position diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index fead31d29dd8..c41f29443ad5 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -14,7 +14,6 @@ import core.NameOps._ import ast.Trees._ import SymUtils._ import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.core.Phases.Phase import collection.mutable import scala.annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitSelf.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitSelf.scala index 307b8ea56854..2186cfcc2c72 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitSelf.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitSelf.scala @@ -5,9 +5,7 @@ import core._ import Contexts.Context import Types._ import MegaPhase._ -import Decorators._ import ast.Trees._ -import Flags._ /** Transform references of the form * diff --git a/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala index 02d072bf6a86..69f6014b7b41 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala @@ -7,18 +7,14 @@ package transform import dotty.tools.dotc.transform.MegaPhase._ import ValueClasses._ -import dotty.tools.dotc.ast.{Trees, tpd} -import scala.collection.{ mutable, immutable } +import dotty.tools.dotc.ast.tpd +import scala.collection.mutable import core._ -import dotty.tools.dotc.core.Phases.Phase -import Types._, Contexts._, Constants._, Names._, NameOps._, Flags._, DenotTransformers._ -import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Scopes._, Denotations._ +import Types._, Contexts._, Names._, Flags._, DenotTransformers._ +import SymDenotations._, Symbols._, StdNames._, Denotations._ import TypeErasure.{ valueErasure, ErasedValueType } -import TypeUtils._ import NameKinds.{ExtMethName, UniqueExtMethName} -import util.Positions._ import Decorators._ -import SymUtils._ /** * Perform Step 1 in the inline classes SIP: Creates extension methods for all diff --git a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala index 27eabbaea25d..128d2a3897d4 100644 --- a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -3,7 +3,6 @@ package transform import core._ import Names._ -import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.transform.MegaPhase._ import ast.Trees._ import ast.untpd @@ -12,15 +11,11 @@ import Types._ import Constants.Constant import Contexts.Context import Symbols._ -import SymDenotations._ import Decorators._ -import dotty.tools.dotc.core.Annotations.ConcreteAnnotation -import dotty.tools.dotc.core.Denotations.SingleDenotation import scala.collection.mutable import DenotTransformers._ -import typer.Checking import NameOps._ -import NameKinds.{AvoidClashName, OuterSelectName} +import NameKinds.OuterSelectName import StdNames._ object FirstTransform { diff --git a/compiler/src/dotty/tools/dotc/transform/Flatten.scala b/compiler/src/dotty/tools/dotc/transform/Flatten.scala index 065c982c2eaa..f18e0a530cfd 100644 --- a/compiler/src/dotty/tools/dotc/transform/Flatten.scala +++ b/compiler/src/dotty/tools/dotc/transform/Flatten.scala @@ -3,7 +3,6 @@ package transform import core._ import DenotTransformers.SymTransformer -import Phases.Phase import Contexts.{Context, FreshContext} import Flags._ import SymDenotations.SymDenotation diff --git a/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala b/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala index b636b8476fa4..bbad627150d4 100644 --- a/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala +++ b/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala @@ -52,7 +52,6 @@ import ast.Trees._ trait FullParameterization { import tpd._ - import FullParameterization._ /** If references to original symbol `referenced` from within fully parameterized method * `derived` should be rewired to some fully parameterized method, the rewiring target symbol, diff --git a/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala b/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala index 2912d5a1391c..b2f44a8d5e22 100644 --- a/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala +++ b/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala @@ -2,21 +2,11 @@ package dotty.tools.dotc package transform import MegaPhase._ -import core.DenotTransformers._ import core.Symbols._ import core.Contexts._ -import core.Types._ -import core.Flags._ import core.Decorators._ -import core.SymDenotations._ -import core.StdNames.nme -import core.Names._ import core.NameOps._ -import ast.Trees._ -import SymUtils._ import dotty.tools.dotc.ast.tpd -import collection.{ mutable, immutable } -import collection.mutable.{ LinkedHashMap, LinkedHashSet, TreeSet } object FunctionalInterfaces { diff --git a/compiler/src/dotty/tools/dotc/transform/GetClass.scala b/compiler/src/dotty/tools/dotc/transform/GetClass.scala index ef3f7b6e5ca3..937f2914cb55 100644 --- a/compiler/src/dotty/tools/dotc/transform/GetClass.scala +++ b/compiler/src/dotty/tools/dotc/transform/GetClass.scala @@ -4,7 +4,6 @@ package transform import ast.tpd import core.Contexts.Context import core.StdNames.nme -import core.Phases.Phase import TypeUtils._ import MegaPhase.MiniPhase diff --git a/compiler/src/dotty/tools/dotc/transform/Getters.scala b/compiler/src/dotty/tools/dotc/transform/Getters.scala index 3010ac20e308..a429533df0c4 100644 --- a/compiler/src/dotty/tools/dotc/transform/Getters.scala +++ b/compiler/src/dotty/tools/dotc/transform/Getters.scala @@ -7,11 +7,8 @@ import Contexts.Context import SymDenotations.SymDenotation import Types._ import Symbols._ -import SymUtils._ -import Constants._ import MegaPhase._ import Flags._ -import Decorators._ import ValueClasses._ /** Performs the following rewritings for fields of a class: diff --git a/compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala b/compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala index d6d8377a4252..b89978c40f33 100644 --- a/compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala +++ b/compiler/src/dotty/tools/dotc/transform/HoistSuperArgs.scala @@ -11,7 +11,6 @@ import core.Flags._ import core.Decorators._ import collection.mutable import ast.Trees._ -import core.Names.TermName import core.NameKinds.SuperArgName import SymUtils._ diff --git a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala index ebabdf124e7e..8323286983b7 100644 --- a/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/compiler/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -8,18 +8,16 @@ import core.Contexts._ import core.Types._ import core.Flags._ import core.Decorators._ -import core.StdNames.{nme, str} +import core.StdNames.nme import core.Names._ import core.NameOps._ import core.NameKinds.ExpandPrefixName -import core.Phases._ import ast.Trees._ import SymUtils._ import ExplicitOuter.outer import util.Store -import util.Positions._ -import collection.{ mutable, immutable } -import collection.mutable.{ HashMap, HashSet, LinkedHashMap, LinkedHashSet, TreeSet } +import collection.mutable +import collection.mutable.{ HashMap, HashSet, LinkedHashMap, TreeSet } object LambdaLift { import ast.tpd._ diff --git a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala index 3be21d41e716..db276cf35efe 100644 --- a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala @@ -8,22 +8,14 @@ import core._ import Contexts._ import Symbols._ import Decorators._ -import NameOps._ import NameKinds._ import StdNames.nme -import rewrites.Rewrites.patch -import util.Positions.Position import dotty.tools.dotc.transform.MegaPhase._ -import dotty.tools.dotc.ast.Trees._ -import dotty.tools.dotc.ast.{untpd, tpd} +import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Constants.Constant -import dotty.tools.dotc.core.Types.{ExprType, NoType, MethodType} -import dotty.tools.dotc.core.Names.Name +import dotty.tools.dotc.core.Types.MethodType import SymUtils._ -import scala.collection.mutable.ListBuffer -import dotty.tools.dotc.core.Denotations.SingleDenotation -import dotty.tools.dotc.core.SymDenotations.SymDenotation -import dotty.tools.dotc.core.DenotTransformers.{SymTransformer, IdentityDenotTransformer, DenotTransformer} +import dotty.tools.dotc.core.DenotTransformers.IdentityDenotTransformer import Erasure.Boxing.adaptToType import java.util.IdentityHashMap diff --git a/compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala b/compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala index 042c7cff4cbf..b1930fa7949f 100644 --- a/compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala +++ b/compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala @@ -7,17 +7,12 @@ import Contexts.Context import Flags._ import SymUtils._ import Symbols._ -import SymDenotations._ import Types._ import Decorators._ import DenotTransformers._ import StdNames._ -import NameOps._ -import Phases._ -import ast.untpd import ast.Trees._ import NameKinds.ImplMethName -import collection.mutable /** Rewrite calls * diff --git a/compiler/src/dotty/tools/dotc/transform/MacroTransform.scala b/compiler/src/dotty/tools/dotc/transform/MacroTransform.scala index 5c3dea9cb79e..9bc1b68651bb 100644 --- a/compiler/src/dotty/tools/dotc/transform/MacroTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/MacroTransform.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc package transform import core._ -import typer._ import Phases._ import ast.Trees._ import Contexts._ diff --git a/compiler/src/dotty/tools/dotc/transform/MacroTransformWithImplicits.scala b/compiler/src/dotty/tools/dotc/transform/MacroTransformWithImplicits.scala index e6c8e255a265..b7153071518d 100644 --- a/compiler/src/dotty/tools/dotc/transform/MacroTransformWithImplicits.scala +++ b/compiler/src/dotty/tools/dotc/transform/MacroTransformWithImplicits.scala @@ -2,12 +2,9 @@ package dotty.tools.dotc package transform import core._ -import typer._ import ast.Trees._ import Contexts._ import Symbols._ -import Decorators._ -import collection.mutable import annotation.tailrec /** A Macrotransform that maintains the necessary infrastructore to support diff --git a/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala b/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala index a834ea622b6e..a65fc8f65264 100644 --- a/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala +++ b/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala @@ -4,13 +4,8 @@ package transform import core._ import ast.Trees._ -import Contexts._, Phases._, Periods._, Symbols._, Decorators._ +import Contexts._, Phases._, Symbols._, Decorators._ import Flags.PackageVal -import scala.annotation.tailrec -import config.Printers.transforms -import scala.util.control.NonFatal -import reporting.trace -import annotation.switch /** A MegaPhase combines a number of mini-phases which are all executed in * a single tree traversal. diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala index aee354a077c7..14cc484a0ee9 100644 --- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala +++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala @@ -3,11 +3,9 @@ package transform import core._ import DenotTransformers._ -import Phases.Phase import Contexts.Context import SymDenotations.SymDenotation import Denotations._ -import Types._ import Symbols._ import SymUtils._ import Constants._ diff --git a/compiler/src/dotty/tools/dotc/transform/Mixin.scala b/compiler/src/dotty/tools/dotc/transform/Mixin.scala index 672b6d0d625b..7e99bffaf502 100644 --- a/compiler/src/dotty/tools/dotc/transform/Mixin.scala +++ b/compiler/src/dotty/tools/dotc/transform/Mixin.scala @@ -12,10 +12,7 @@ import Types._ import Decorators._ import DenotTransformers._ import StdNames._ -import NameOps._ import NameKinds._ -import Phases._ -import ast.untpd import ast.Trees._ import collection.mutable diff --git a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala index 16dbd0ad3ba6..ddd44dc28367 100644 --- a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala +++ b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala @@ -2,7 +2,7 @@ package dotty.tools.dotc package transform import core._ -import Symbols._, Types._, Contexts._, SymDenotations._, DenotTransformers._, Flags._ +import Symbols._, Types._, Contexts._, DenotTransformers._, Flags._ import util.Positions._ import SymUtils._ import StdNames._, NameOps._ diff --git a/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala b/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala index c71dba2b9640..cbefe94663b2 100644 --- a/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala +++ b/compiler/src/dotty/tools/dotc/transform/MoveStatics.scala @@ -3,14 +3,12 @@ package dotty.tools.dotc.transform import dotty.tools.dotc.ast.{Trees, tpd} import dotty.tools.dotc.core.Annotations.Annotation import dotty.tools.dotc.core.Contexts.Context -import dotty.tools.dotc.core.DenotTransformers.{InfoTransformer, SymTransformer} +import dotty.tools.dotc.core.DenotTransformers.SymTransformer import dotty.tools.dotc.core.SymDenotations.SymDenotation -import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.core.NameOps._ -import dotty.tools.dotc.core.{Flags, Names} +import dotty.tools.dotc.core.Flags import dotty.tools.dotc.core.Names.Name import dotty.tools.dotc.core.StdNames.nme -import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.core.Types.MethodType import dotty.tools.dotc.transform.MegaPhase.MiniPhase diff --git a/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala b/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala index 80b6944625f8..1df60572dd87 100644 --- a/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala +++ b/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala @@ -2,11 +2,9 @@ package dotty.tools.dotc package transform import core._ -import Contexts._, Symbols._, Types._, Flags._, Decorators._, StdNames._, Constants._, Phases._ +import Contexts._, Symbols._, Types._, Flags._, StdNames._ import MegaPhase._ -import ast.Trees._ import NameKinds.NonLocalReturnKeyName -import collection.mutable object NonLocalReturns { import ast.tpd._ diff --git a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala index 2f166891f353..9f73b4e53ae0 100644 --- a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala +++ b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala @@ -2,8 +2,7 @@ package dotty.tools.dotc package transform import core._ -import Flags._, Symbols._, Contexts._, Types._, Scopes._, Decorators._ -import util.HashSet +import Flags._, Symbols._, Contexts._, Scopes._, Decorators._ import collection.mutable import collection.immutable.BitSet import scala.annotation.tailrec diff --git a/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala b/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala index b876a3a9b47e..138fe95114af 100644 --- a/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala +++ b/compiler/src/dotty/tools/dotc/transform/ParamForwarding.scala @@ -4,7 +4,7 @@ package transform import core._ import ast.Trees._ import Contexts._, Types._, Symbols._, Flags._, TypeUtils._, DenotTransformers._, StdNames._ -import Decorators._, NameOps._ +import Decorators._ import config.Printers.typr /** For all parameter accessors diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index a04c7329710a..95308f4cd9fe 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -5,15 +5,14 @@ import scala.annotation.tailrec import core._ import MegaPhase._ import collection.mutable -import SymDenotations._, Symbols._, Contexts._, Types._, Names._, StdNames._, NameOps._ +import Symbols._, Contexts._, Types._, StdNames._, NameOps._ import ast.Trees._ import util.Positions._ import typer.Applications.{isProductMatch, isGetMatch, productSelectors} import SymUtils._ import Flags._, Constants._ import Decorators._ -import patmat.Space -import NameKinds.{UniqueNameKind, PatMatStdBinderName, PatMatAltsName, PatMatResultName} +import NameKinds.{PatMatStdBinderName, PatMatAltsName, PatMatResultName} import config.Printers.patmatch import reporting.diagnostic.messages._ diff --git a/compiler/src/dotty/tools/dotc/transform/PrimitiveForwarders.scala b/compiler/src/dotty/tools/dotc/transform/PrimitiveForwarders.scala index 853c74c815c9..e21137cffa35 100644 --- a/compiler/src/dotty/tools/dotc/transform/PrimitiveForwarders.scala +++ b/compiler/src/dotty/tools/dotc/transform/PrimitiveForwarders.scala @@ -4,20 +4,8 @@ package transform import core._ import MegaPhase._ import Contexts.Context -import Flags._ -import SymUtils._ import Symbols._ -import SymDenotations._ -import Types._ -import Decorators._ import DenotTransformers._ -import StdNames._ -import NameOps._ -import ast.Trees._ -import util.Positions._ -import Names._ -import collection.mutable -import ResolveSuper._ /** This phase adds forwarder where mixedin generic and primitive typed methods have a missmatch. * In particular for every method that is declared both as generic with a primitive type and with a primitive type diff --git a/compiler/src/dotty/tools/dotc/transform/ProtectedAccessors.scala b/compiler/src/dotty/tools/dotc/transform/ProtectedAccessors.scala index 4528d735d12d..75bf2085c3fa 100644 --- a/compiler/src/dotty/tools/dotc/transform/ProtectedAccessors.scala +++ b/compiler/src/dotty/tools/dotc/transform/ProtectedAccessors.scala @@ -7,7 +7,6 @@ import core.Symbols._ import core.Flags._ import core.Decorators._ import MegaPhase.MiniPhase -import ast.Trees._ import config.Printers.transforms /** Add accessors for all protected accesses. An accessor is needed if @@ -49,7 +48,6 @@ object ProtectedAccessors { class ProtectedAccessors extends MiniPhase { import ast.tpd._ - import ProtectedAccessors._ override def phaseName = ProtectedAccessors.name diff --git a/compiler/src/dotty/tools/dotc/transform/PruneErasedDefs.scala b/compiler/src/dotty/tools/dotc/transform/PruneErasedDefs.scala index 2da2fcd08122..771a3c0d31dd 100644 --- a/compiler/src/dotty/tools/dotc/transform/PruneErasedDefs.scala +++ b/compiler/src/dotty/tools/dotc/transform/PruneErasedDefs.scala @@ -7,7 +7,6 @@ import DenotTransformers.SymTransformer import Flags._ import SymDenotations._ import Symbols._ -import Types._ import typer.RefChecks import MegaPhase.MiniPhase import ast.tpd diff --git a/compiler/src/dotty/tools/dotc/transform/RenameLifted.scala b/compiler/src/dotty/tools/dotc/transform/RenameLifted.scala index ea7180b51917..b0e972e0dd7b 100644 --- a/compiler/src/dotty/tools/dotc/transform/RenameLifted.scala +++ b/compiler/src/dotty/tools/dotc/transform/RenameLifted.scala @@ -6,7 +6,6 @@ import dotty.tools.dotc.core.DenotTransformers.SymTransformer import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.NameKinds._ import dotty.tools.dotc.core.Names._ -import dotty.tools.dotc.core.Phases import dotty.tools.dotc.core.SymDenotations.SymDenotation import dotty.tools.dotc.core.Symbols._ import dotty.tools.dotc.transform.MegaPhase.MiniPhase diff --git a/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala b/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala index 4a9e4409ffa6..69b9fc44dd9a 100644 --- a/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala +++ b/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala @@ -7,17 +7,10 @@ import Contexts.Context import Flags._ import SymUtils._ import Symbols._ -import SymDenotations._ -import Types._ import Decorators._ import DenotTransformers._ -import StdNames._ import NameOps._ import NameKinds._ -import ast.Trees._ -import util.Positions._ -import Names._ -import collection.mutable import ResolveSuper._ /** This phase adds super accessors and method overrides where diff --git a/compiler/src/dotty/tools/dotc/transform/RestoreScopes.scala b/compiler/src/dotty/tools/dotc/transform/RestoreScopes.scala index b88d46fdda6a..605e9f7c1c08 100644 --- a/compiler/src/dotty/tools/dotc/transform/RestoreScopes.scala +++ b/compiler/src/dotty/tools/dotc/transform/RestoreScopes.scala @@ -6,11 +6,8 @@ import DenotTransformers.IdentityDenotTransformer import Contexts.Context import Symbols._ import Scopes._ -import collection.mutable import MegaPhase.MiniPhase -import SymDenotations._ import ast.Trees._ -import NameOps._ import StdNames._ /** The preceding lambda lift and flatten phases move symbols to different scopes diff --git a/compiler/src/dotty/tools/dotc/transform/SeqLiterals.scala b/compiler/src/dotty/tools/dotc/transform/SeqLiterals.scala index 2e17a211a04d..9bebceae6c7c 100644 --- a/compiler/src/dotty/tools/dotc/transform/SeqLiterals.scala +++ b/compiler/src/dotty/tools/dotc/transform/SeqLiterals.scala @@ -2,12 +2,8 @@ package dotty.tools.dotc package transform import core._ -import Types._ import dotty.tools.dotc.transform.MegaPhase._ import Contexts.Context -import Symbols._ -import Phases._ -import Decorators._ /** A transformer that eliminates SeqLiteral's, transforming `SeqLiteral(elems)` to an operation * equivalent to diff --git a/compiler/src/dotty/tools/dotc/transform/ShortcutImplicits.scala b/compiler/src/dotty/tools/dotc/transform/ShortcutImplicits.scala index dfd7ae8335e8..67edcb53d8ac 100644 --- a/compiler/src/dotty/tools/dotc/transform/ShortcutImplicits.scala +++ b/compiler/src/dotty/tools/dotc/transform/ShortcutImplicits.scala @@ -7,15 +7,11 @@ import core.Symbols._ import core.Contexts._ import core.Types._ import core.Flags._ -import core.Decorators._ import core.StdNames.nme -import core.Names._ -import core.NameOps._ import core.NameKinds.DirectMethodName import ast.Trees._ import ast.tpd import util.Store -import collection.mutable /** This phase optimizes code using implicit function types, by applying two rewrite rules. * Let IF be the implicit function type diff --git a/compiler/src/dotty/tools/dotc/transform/Splitter.scala b/compiler/src/dotty/tools/dotc/transform/Splitter.scala index f8093d0f8cf5..172865fd775d 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splitter.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splitter.scala @@ -4,7 +4,7 @@ package transform import MegaPhase._ import ast.Trees._ import core._ -import Contexts._, Types._, Decorators._, Denotations._, Symbols._, SymDenotations._, Names._ +import Contexts._, Types._ object Splitter { val name = "splitter" diff --git a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala index 2cdc5b2c2525..5e6c17a6786f 100644 --- a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -5,7 +5,7 @@ import dotty.tools.dotc.ast.{Trees, tpd} import scala.collection.mutable import ValueClasses.isMethodWithExtension import core._ -import Types._, Contexts._, Names._, Flags._, Symbols._, NameOps._, Trees._ +import Contexts._, Flags._, Symbols._, NameOps._, Trees._ import TypeUtils._, SymUtils._ import DenotTransformers.DenotTransformer import Symbols._ diff --git a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala index aabd341533e2..d226b0113e55 100644 --- a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala @@ -6,9 +6,7 @@ import Types._ import Contexts._ import Symbols._ import SymDenotations._ -import Decorators._ import Names._ -import StdNames._ import NameOps._ import NameKinds._ import Flags._ diff --git a/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala b/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala index 86dcbbed2196..b48ba5ddead8 100644 --- a/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/SyntheticMethods.scala @@ -2,19 +2,13 @@ package dotty.tools.dotc package transform import core._ -import Symbols._, Types._, Contexts._, Names._, StdNames._, Constants._, SymUtils._ -import scala.collection.{ mutable, immutable } +import Symbols._, Types._, Contexts._, StdNames._, Constants._, SymUtils._ import Flags._ -import MegaPhase._ import DenotTransformers._ -import ast.Trees._ -import ast.untpd import Decorators._ import NameOps._ import Annotations.Annotation import ValueClasses.isDerivedValueClass -import scala.collection.mutable.ListBuffer -import scala.language.postfixOps /** Synthetic method implementations for case classes, case objects, * and value classes. diff --git a/compiler/src/dotty/tools/dotc/transform/TailRec.scala b/compiler/src/dotty/tools/dotc/transform/TailRec.scala index 405e3dd25cb7..94615a914b1a 100644 --- a/compiler/src/dotty/tools/dotc/transform/TailRec.scala +++ b/compiler/src/dotty/tools/dotc/transform/TailRec.scala @@ -12,7 +12,6 @@ import Types._ import NameKinds.TailLabelName import MegaPhase.MiniPhase import reporting.diagnostic.messages.TailrecNotApplicable -import util.Property /** * A Tail Rec Transformer diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala index d46d2dbcc510..7f36472254ed 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -1,37 +1,27 @@ package dotty.tools.dotc package transform -import MegaPhase._ import core.Names.Name import core.DenotTransformers._ -import core.Denotations._ import core.SymDenotations._ import core.Contexts._ import core.Symbols._ import core.Types._ import core.Flags._ -import core.Constants._ import core.StdNames._ -import core.NameOps._ import core.NameKinds.{DocArtifactName, OuterSelectName} import core.Decorators._ -import core.TypeErasure.isErasedType import core.Phases.Phase import core.Mode -import SymUtils._ import typer._ import typer.ErrorReporting._ import reporting.ThrowingReporter import ast.Trees._ import ast.{tpd, untpd} -import util.SourcePosition import util.Chars._ import collection.mutable import ProtoTypes._ -import config.Printers -import java.lang.AssertionError -import dotty.tools.dotc.core.Names import scala.util.control.NonFatal diff --git a/compiler/src/dotty/tools/dotc/transform/TreeExtractors.scala b/compiler/src/dotty/tools/dotc/transform/TreeExtractors.scala index 680f21bff1ac..38dd28be2f16 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeExtractors.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeExtractors.scala @@ -2,8 +2,8 @@ package dotty.tools.dotc package transform import ast.{Trees, tpd} -import core._, core.Decorators._ -import Contexts._, Flags._, Trees._, Types._, StdNames._, Symbols._ +import core._ +import Contexts._, Trees._, Types._, StdNames._, Symbols._ import ValueClasses._ object TreeExtractors { diff --git a/compiler/src/dotty/tools/dotc/transform/TryCatchPatterns.scala b/compiler/src/dotty/tools/dotc/transform/TryCatchPatterns.scala index 530b1a39a92c..40a0c8f00234 100644 --- a/compiler/src/dotty/tools/dotc/transform/TryCatchPatterns.scala +++ b/compiler/src/dotty/tools/dotc/transform/TryCatchPatterns.scala @@ -6,7 +6,6 @@ import core.StdNames._ import ast.Trees._ import core.Types._ import core.NameKinds.ExceptionBinderName -import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.core.Flags import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.transform.MegaPhase.MiniPhase diff --git a/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala b/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala index d1e7dce35c53..4239b8248c10 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeUtils.scala @@ -6,10 +6,6 @@ import TypeErasure.ErasedValueType import Types._ import Contexts._ import Symbols._ -import Decorators._ -import StdNames.nme -import NameOps._ -import language.implicitConversions object TypeUtils { /** A decorator that provides methods on types diff --git a/compiler/src/dotty/tools/dotc/transform/VCElideAllocations.scala b/compiler/src/dotty/tools/dotc/transform/VCElideAllocations.scala index 2ba909733ba3..674895af5fd9 100644 --- a/compiler/src/dotty/tools/dotc/transform/VCElideAllocations.scala +++ b/compiler/src/dotty/tools/dotc/transform/VCElideAllocations.scala @@ -1,11 +1,11 @@ package dotty.tools.dotc package transform -import ast.{Trees, tpd} -import core._, core.Decorators._ -import Contexts._, Trees._, StdNames._, Symbols._ -import DenotTransformers._, MegaPhase._, Phases.Phase -import ExtensionMethods._, TreeExtractors._, ValueClasses._ +import ast.tpd +import core._ +import Contexts._, Symbols._ +import DenotTransformers._, MegaPhase._ +import TreeExtractors._, ValueClasses._ /** This phase elides unnecessary value class allocations * diff --git a/compiler/src/dotty/tools/dotc/transform/VCInlineMethods.scala b/compiler/src/dotty/tools/dotc/transform/VCInlineMethods.scala index 2a526ebe3ae3..edf720dcc321 100644 --- a/compiler/src/dotty/tools/dotc/transform/VCInlineMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/VCInlineMethods.scala @@ -2,12 +2,11 @@ package dotty.tools.dotc package transform import ast.{Trees, tpd} -import core._, core.Decorators._ +import core._ import Contexts._, Trees._, Types._ -import DenotTransformers._, MegaPhase._, Phases.Phase +import DenotTransformers._, MegaPhase._ import ExtensionMethods._, ValueClasses._ -import collection.mutable.ListBuffer /** This phase inlines calls to methods of value classes. * diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index bb2f292cf772..319e9ce5722b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -3,21 +3,17 @@ package dotc package typer import core._ -import ast.{TreeInfo, Trees, tpd, untpd} +import ast.{Trees, tpd, untpd} import util.Positions._ import util.Stats.track import Trees.Untyped -import Mode.ImplicitsEnabled import Contexts._ import Flags._ -import Denotations._ -import NameOps._ import Symbols._ import Types._ import Decorators._ import ErrorReporting._ import Trees._ -import config.Config import Names._ import StdNames._ import NameKinds.DefaultGetterName @@ -28,13 +24,11 @@ import collection.mutable import config.Printers.{overload, typr, unapp} import TypeApplications._ -import language.implicitConversions import reporting.diagnostic.Message import reporting.trace import Constants.{Constant, IntTag, LongTag} import dotty.tools.dotc.reporting.diagnostic.messages.{NotAnExtractor, UnapplyInvalidNumberOfArguments} -import scala.collection.mutable.ListBuffer object Applications { import tpd._ @@ -161,14 +155,12 @@ object Applications { if (defs != null && defs.nonEmpty) tpd.Block(defs.toList, tree) else tree } -import Applications._ trait Applications extends Compatibility { self: Typer with Dynamic => import Applications._ import tpd.{ cpy => _, _ } import untpd.cpy - import Dynamic.isDynamicMethod /** @tparam Arg the type of arguments, could be tpd.Tree, untpd.Tree, or Type * @param methRef the reference to the method of the application diff --git a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala index e14b7f122b6e..d1ee5da0957f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala +++ b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala @@ -14,7 +14,6 @@ import dotty.tools.dotc.core.Decorators._ import util.Positions._ import core.Symbols._ import core.Definitions -import Inferencing._ import ErrorReporting._ import dotty.tools.dotc.reporting.diagnostic.messages.ReassignmentToVal diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala index 3418f83f9d40..44264c8fcbb4 100644 --- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -3,17 +3,14 @@ package dotc package typer import core._ -import ast.{Trees, untpd, tpd, TreeInfo} +import ast.{Trees, untpd, tpd} import Contexts._ import Types._ import Flags._ -import NameOps._ import Symbols._ -import Decorators._ import Names._ import StdNames._ import NameKinds.UniqueName -import Inferencing._ import util.Positions._ import collection.mutable import Trees._ diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 780f80aa50d5..39c77140ad2d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -3,7 +3,7 @@ package dotc package typer import core._ -import ast.{Trees, untpd, tpd, TreeInfo} +import ast.{Trees, untpd, tpd} import util.Positions._ import util.Stats.{track, record, monitored} import printing.{Showable, Printer} @@ -13,27 +13,23 @@ import Types._ import Flags._ import TypeErasure.{erasure, hasStableErasure} import Mode.ImplicitsEnabled -import Denotations._ import NameOps._ import NameKinds.LazyImplicitName -import SymDenotations._ import Symbols._ import Types._ import Decorators._ import Names._ import StdNames._ import Constants._ -import Applications._ import ProtoTypes._ import ErrorReporting._ -import Annotations.Annotation -import reporting.diagnostic.{Message, MessageContainer} +import reporting.diagnostic.Message import Inferencing.fullyDefinedType import Trees._ import Hashable._ import util.Property import config.Config -import config.Printers.{implicits, implicitsDetailed, typr} +import config.Printers.{implicits, implicitsDetailed} import collection.mutable import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala index eecf905169eb..571c422dc3ef 100644 --- a/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala +++ b/compiler/src/dotty/tools/dotc/typer/ImportInfo.scala @@ -7,8 +7,7 @@ import ast.Trees._ import core._ import printing.{Printer, Showable} import util.SimpleIdentityMap -import Symbols._, Names._, Denotations._, Types._, Contexts._, StdNames._, Flags._ -import Decorators.StringInterpolators +import Symbols._, Names._, Types._, Contexts._, StdNames._, Flags._ import Implicits.RenamedImplicitRef object ImportInfo { diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala index 07036a81635a..9c36550f741d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala @@ -4,23 +4,17 @@ package typer import core._ import ast._ -import Contexts._, Types._, Flags._, Denotations._, Names._, StdNames._, NameOps._, Symbols._ +import Contexts._, Types._, Flags._, Symbols._ import Trees._ -import Constants._ -import Scopes._ import ProtoTypes._ import NameKinds.UniqueName -import annotation.unchecked import util.Positions._ import util.{Stats, SimpleIdentityMap} -import util.common._ import Decorators._ -import Uniques._ -import config.Printers.{typr, constr} +import config.Printers.typr import annotation.tailrec import reporting._ import collection.mutable -import config.Config import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 51ac332351d0..ca4c52a93673 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -2,7 +2,6 @@ package dotty.tools package dotc package typer -import dotty.tools.dotc.ast.Trees.NamedArg import dotty.tools.dotc.ast.{Trees, untpd, tpd, TreeTypeMap} import Trees._ import core._ @@ -13,23 +12,15 @@ import Decorators._ import Constants._ import StdNames._ import Contexts.Context -import Names.{Name, TermName, EmptyTermName} -import NameOps._ -import NameKinds.{ClassifiedNameKind, InlineAccessorName, UniqueInlineName, InlineScrutineeName, InlineBinderName} +import Names.Name import ProtoTypes.selectionProto import SymDenotations.SymDenotation -import Annotations._ -import transform.{ExplicitOuter, AccessProxies} import Inferencing.fullyDefinedType import config.Printers.inlining import ErrorReporting.errorTree import collection.mutable -import transform.TypeUtils._ -import transform.SymUtils._ import reporting.trace import util.Positions.Position -import util.Property -import ast.TreeInfo object Inliner { import tpd._ @@ -166,7 +157,6 @@ object Inliner { */ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { import tpd._ - import Inliner._ private val (methPart, callTypeArgs, callValueArgss) = decomposeCall(call) private val inlinedMethod = methPart.symbol diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 762cf2e6da16..754cab3125bd 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -4,24 +4,20 @@ package typer import core._ import ast._ -import Trees._, Constants._, StdNames._, Scopes._, Denotations._, Comments._ +import Trees._, StdNames._, Scopes._, Denotations._, Comments._ import Contexts._, Symbols._, Types._, SymDenotations._, Names._, NameOps._, Flags._, Decorators._ import NameKinds.DefaultGetterName import ast.desugar, ast.desugar._ import ProtoTypes._ import util.Positions._ -import util.{Property, SourcePosition, DotClass} +import util.Property import collection.mutable -import annotation.tailrec -import ErrorReporting._ import tpd.ListOfTreeDecorator import config.Config -import config.Printers.{typr, noPrinter} +import config.Printers.typr import Annotations._ import Inferencing._ import transform.ValueClasses._ -import TypeApplications._ -import language.implicitConversions import reporting.diagnostic.messages._ trait NamerContextOps { this: Context => diff --git a/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala b/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala index 847466a7552b..ebf54354d763 100644 --- a/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala +++ b/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala @@ -2,33 +2,21 @@ package dotty.tools package dotc package typer -import dotty.tools.dotc.ast.Trees.NamedArg -import dotty.tools.dotc.ast.{Trees, untpd, tpd, TreeTypeMap} +import dotty.tools.dotc.ast.{Trees, untpd, tpd} import Trees._ import core._ import Flags._ import Symbols._ import Types._ import Decorators._ -import Constants._ import StdNames.nme import Contexts.Context -import Names.{Name, TermName, EmptyTermName} -import NameOps._ -import NameKinds.{ClassifiedNameKind, InlineAccessorName, UniqueInlineName} -import ProtoTypes.selectionProto -import SymDenotations.SymDenotation +import Names.Name +import NameKinds.{InlineAccessorName, UniqueInlineName} import Annotations._ -import transform.{ExplicitOuter, AccessProxies} -import Inferencing.fullyDefinedType +import transform.AccessProxies import config.Printers.inlining -import ErrorReporting.errorTree -import collection.mutable -import transform.TypeUtils._ -import reporting.trace -import util.Positions.Position import util.Property -import ast.TreeInfo object PrepareInlineable { import tpd._ diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index 52882c91d63a..b5688785d5d1 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -4,20 +4,14 @@ package typer import core._ import ast._ -import Contexts._, Types._, Flags._, Denotations._, Names._, StdNames._, NameOps._, Symbols._ +import Contexts._, Types._, Denotations._, Names._, StdNames._, NameOps._, Symbols._ import NameKinds.DepParamName import Trees._ import Constants._ -import Scopes._ -import annotation.unchecked -import util.Positions._ import util.{Stats, SimpleIdentityMap} -import util.common._ import Decorators._ import Uniques._ -import ErrorReporting.errorType import config.Printers.typr -import collection.mutable import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/dotc/typer/ReTyper.scala b/compiler/src/dotty/tools/dotc/typer/ReTyper.scala index 7818eff87d34..d2b215dbbf81 100644 --- a/compiler/src/dotty/tools/dotc/typer/ReTyper.scala +++ b/compiler/src/dotty/tools/dotc/typer/ReTyper.scala @@ -9,10 +9,8 @@ import StdNames._ import Decorators._ import typer.ProtoTypes._ import ast.{tpd, untpd} -import ast.Trees._ import scala.util.control.NonFatal import util.Positions.Position -import config.Printers.typr /** A version of Typer that keeps all symbols defined and referenced in a * previously typed tree. diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index d25617da85c8..0d7e582f71f0 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -14,7 +14,6 @@ import ast._ import Trees._ import MegaPhase._ import config.Printers.{checks, noPrinter} -import util.DotClass import scala.util.Failure import config.NoScalaVersion import Decorators._ diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala index 06ddce362853..97e75c8376c3 100644 --- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -4,14 +4,13 @@ package typer import core._ import ast._ -import Scopes._, Contexts._, Constants._, Types._, Symbols._, Names._, Flags._, Decorators._ -import ErrorReporting._, Annotations._, Denotations._, SymDenotations._, StdNames._, TypeErasure._ +import Contexts._, Constants._, Types._, Symbols._, Names._, Flags._, Decorators._ +import ErrorReporting._, Annotations._, Denotations._, SymDenotations._, StdNames._ import util.Positions._ import config.Printers.typr import ast.Trees._ import NameOps._ import collection.mutable -import reporting.diagnostic.Message import reporting.diagnostic.messages._ import Checking.checkNoPrivateLeaks diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 6f7dde5baa70..ff1964f1ee62 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -11,7 +11,6 @@ import Scopes._ import Denotations._ import ProtoTypes._ import Contexts._ -import Comments._ import Symbols._ import Types._ import SymDenotations._ @@ -27,7 +26,7 @@ import Inferencing._ import EtaExpansion.etaExpand import util.Positions._ import util.common._ -import util.{Property, SourcePosition} +import util.Property import collection.mutable import annotation.tailrec @@ -39,10 +38,7 @@ import NavigateAST._ import transform.SymUtils._ import transform.TypeUtils._ import reporting.trace -import config.Config -import language.implicitConversions -import printing.SyntaxHighlighting._ object Typer { @@ -91,7 +87,6 @@ class Typer extends Namer import Typer._ import tpd.{cpy => _, _} import untpd.cpy - import Dynamic.isDynamicMethod import reporting.diagnostic.Message import reporting.diagnostic.messages._ diff --git a/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala b/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala index 869ed3e87d56..21dc77049a15 100644 --- a/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala +++ b/compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala @@ -3,12 +3,11 @@ package typer import dotty.tools.dotc.ast.{ Trees, tpd } import core._ -import Types._, Contexts._, Flags._, Symbols._, Annotations._, Trees._, NameOps._ +import Types._, Contexts._, Flags._, Symbols._, Trees._ import Decorators._ import Variances._ import NameKinds._ import util.Positions._ -import rewrites.Rewrites.patch import config.Printers.variances import reporting.trace diff --git a/compiler/src/dotty/tools/dotc/typer/Variances.scala b/compiler/src/dotty/tools/dotc/typer/Variances.scala index e0e6b79b44a7..16aca7f82dac 100644 --- a/compiler/src/dotty/tools/dotc/typer/Variances.scala +++ b/compiler/src/dotty/tools/dotc/typer/Variances.scala @@ -1,13 +1,10 @@ package dotty.tools.dotc package typer -import dotty.tools.dotc.ast.{Trees, tpd} import core._ -import Types._, Contexts._, Flags._, Symbols._, Annotations._, Trees._ -import Decorators._ +import Types._, Contexts._, Flags._, Symbols._, Annotations._ object Variances { - import tpd._ type Variance = FlagSet val Bivariant = VarianceFlags diff --git a/compiler/src/dotty/tools/dotc/util/NameTransformer.scala b/compiler/src/dotty/tools/dotc/util/NameTransformer.scala index 65e9fef8ddb8..9ad318704a64 100644 --- a/compiler/src/dotty/tools/dotc/util/NameTransformer.scala +++ b/compiler/src/dotty/tools/dotc/util/NameTransformer.scala @@ -3,7 +3,6 @@ package dotc package util import core.Names._ -import core.Decorators._ import collection.mutable import util.Chars.isValidJVMMethodChar diff --git a/compiler/src/dotty/tools/dotc/util/ShowPickled.scala b/compiler/src/dotty/tools/dotc/util/ShowPickled.scala index a0939141f804..7cf1dedc24bc 100644 --- a/compiler/src/dotty/tools/dotc/util/ShowPickled.scala +++ b/compiler/src/dotty/tools/dotc/util/ShowPickled.scala @@ -1,7 +1,7 @@ package dotty.tools.dotc package util -import java.io.{File, FileInputStream, PrintStream} +import java.io.PrintStream import java.lang.Long.toHexString import java.lang.Float.intBitsToFloat import java.lang.Double.longBitsToDouble diff --git a/compiler/src/dotty/tools/dotc/util/SourceFile.scala b/compiler/src/dotty/tools/dotc/util/SourceFile.scala index d7cafdaba633..8feb07cdb430 100644 --- a/compiler/src/dotty/tools/dotc/util/SourceFile.scala +++ b/compiler/src/dotty/tools/dotc/util/SourceFile.scala @@ -4,11 +4,9 @@ package util import scala.collection.mutable.ArrayBuffer import dotty.tools.io._ -import annotation.tailrec import java.util.regex.Pattern import java.io.IOException import Chars._ -import ScriptSourceFile._ import Positions._ import scala.io.Codec import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/dotc/util/common.scala b/compiler/src/dotty/tools/dotc/util/common.scala index 7b81416a7f74..a9477372ab80 100644 --- a/compiler/src/dotty/tools/dotc/util/common.scala +++ b/compiler/src/dotty/tools/dotc/util/common.scala @@ -1,7 +1,6 @@ package dotty.tools.dotc package util -import core.Names.Name import core.Types.WildcardType /** Common values hoisted out for performance */ diff --git a/compiler/src/dotty/tools/io/AbstractFile.scala b/compiler/src/dotty/tools/io/AbstractFile.scala index 6ab93f7328ce..88dec819d7d5 100644 --- a/compiler/src/dotty/tools/io/AbstractFile.scala +++ b/compiler/src/dotty/tools/io/AbstractFile.scala @@ -10,7 +10,7 @@ import java.io.{ ByteArrayOutputStream } import java.net.URL -import java.nio.file.{FileAlreadyExistsException, Files, Paths} +import java.nio.file.{Files, Paths} /** * An abstraction over files for use in the reflection/compiler libraries. diff --git a/compiler/src/dotty/tools/io/Directory.scala b/compiler/src/dotty/tools/io/Directory.scala index 28d936e92666..043d8d44c231 100644 --- a/compiler/src/dotty/tools/io/Directory.scala +++ b/compiler/src/dotty/tools/io/Directory.scala @@ -9,9 +9,7 @@ package dotty.tools.io import java.nio.file.{Files, Paths} -import java.util.stream.Collectors -import scala.collection.JavaConverters._ /** * ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' diff --git a/compiler/src/dotty/tools/io/File.scala b/compiler/src/dotty/tools/io/File.scala index 894a928044ce..1b4d130ab6cc 100644 --- a/compiler/src/dotty/tools/io/File.scala +++ b/compiler/src/dotty/tools/io/File.scala @@ -9,7 +9,7 @@ package dotty.tools.io import java.io.{ - FileInputStream, FileOutputStream, BufferedWriter, OutputStreamWriter, + BufferedWriter, OutputStreamWriter, BufferedOutputStream, IOException, PrintWriter } import java.nio.file.{Files, Paths} diff --git a/compiler/src/dotty/tools/io/Jar.scala b/compiler/src/dotty/tools/io/Jar.scala index 5e24f486cf13..ffd406617c05 100644 --- a/compiler/src/dotty/tools/io/Jar.scala +++ b/compiler/src/dotty/tools/io/Jar.scala @@ -7,11 +7,11 @@ package dotty.tools package io -import java.io.{ InputStream, OutputStream, IOException, FileNotFoundException, FileInputStream, DataOutputStream } +import java.io.{ InputStream, OutputStream, DataOutputStream } import java.util.jar._ import scala.collection.JavaConverters._ import Attributes.Name -import scala.language.{postfixOps, implicitConversions} +import scala.language.postfixOps import scala.annotation.tailrec // Attributes.Name instances: diff --git a/compiler/src/dotty/tools/io/Path.scala b/compiler/src/dotty/tools/io/Path.scala index e5223a580a7d..2095a9227983 100644 --- a/compiler/src/dotty/tools/io/Path.scala +++ b/compiler/src/dotty/tools/io/Path.scala @@ -5,7 +5,6 @@ package dotty.tools.io -import scala.language.implicitConversions import java.io.RandomAccessFile import java.nio.file._ import java.net.{URI, URL} diff --git a/compiler/src/dotty/tools/io/PlainFile.scala b/compiler/src/dotty/tools/io/PlainFile.scala index 9eb2705dd622..faeb7c6c3b24 100644 --- a/compiler/src/dotty/tools/io/PlainFile.scala +++ b/compiler/src/dotty/tools/io/PlainFile.scala @@ -6,7 +6,6 @@ package dotty.tools package io -import java.nio.file.{Files, NotDirectoryException} /** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */ class PlainDirectory(givenPath: Directory) extends PlainFile(givenPath) { diff --git a/compiler/src/dotty/tools/io/ZipArchive.scala b/compiler/src/dotty/tools/io/ZipArchive.scala index d83fd230f0a6..25f4dd13502c 100644 --- a/compiler/src/dotty/tools/io/ZipArchive.scala +++ b/compiler/src/dotty/tools/io/ZipArchive.scala @@ -6,13 +6,12 @@ package dotty.tools.io import java.net.URL -import java.io.{ IOException, InputStream, ByteArrayInputStream, FilterInputStream } +import java.io.{ IOException, InputStream, FilterInputStream } import java.nio.file.Files -import java.util.zip.{ ZipEntry, ZipFile, ZipInputStream } +import java.util.zip.{ ZipEntry, ZipFile } import java.util.jar.Manifest import scala.collection.mutable import scala.collection.JavaConverters._ -import scala.annotation.tailrec /** An abstraction for zip files and streams. Everything is written the way * it is for performance: we come through here a lot on every run. Be careful diff --git a/compiler/src/dotty/tools/package.scala b/compiler/src/dotty/tools/package.scala index aace5e3e7da1..da2daf6eba97 100644 --- a/compiler/src/dotty/tools/package.scala +++ b/compiler/src/dotty/tools/package.scala @@ -1,5 +1,4 @@ package dotty -import scala.annotation.Annotation package object tools { // Ensure this object is already classloaded, since it's only actually used diff --git a/compiler/src/dotty/tools/repl/ParseResult.scala b/compiler/src/dotty/tools/repl/ParseResult.scala index 2722cd5f6b2e..f59a857e7cdd 100644 --- a/compiler/src/dotty/tools/repl/ParseResult.scala +++ b/compiler/src/dotty/tools/repl/ParseResult.scala @@ -7,9 +7,7 @@ import dotc.parsing.Parsers.Parser import dotc.parsing.Tokens import dotc.util.SourceFile import dotc.ast.untpd -import dotc.reporting._ -import results._ import scala.annotation.internal.sharable diff --git a/compiler/src/dotty/tools/repl/Rendering.scala b/compiler/src/dotty/tools/repl/Rendering.scala index 65c932b20a9c..e0722395ab1f 100644 --- a/compiler/src/dotty/tools/repl/Rendering.scala +++ b/compiler/src/dotty/tools/repl/Rendering.scala @@ -5,9 +5,7 @@ import java.io.{ StringWriter, PrintWriter } import java.lang.{ ClassLoader, ExceptionInInitializerError } import java.lang.reflect.InvocationTargetException -import scala.util.control.NonFatal -import dotc.core.Types._ import dotc.core.Contexts.Context import dotc.core.Denotations.Denotation import dotc.core.Flags diff --git a/compiler/src/dotty/tools/repl/ReplCompiler.scala b/compiler/src/dotty/tools/repl/ReplCompiler.scala index cf81040d655d..3f3606ef0906 100644 --- a/compiler/src/dotty/tools/repl/ReplCompiler.scala +++ b/compiler/src/dotty/tools/repl/ReplCompiler.scala @@ -8,7 +8,6 @@ import dotty.tools.dotc.core.Contexts._ import dotty.tools.dotc.core.Decorators._ import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.Names._ -import dotty.tools.dotc.core.Phases import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.core.StdNames._ import dotty.tools.dotc.core.Symbols._ diff --git a/compiler/src/dotty/tools/repl/ReplDriver.scala b/compiler/src/dotty/tools/repl/ReplDriver.scala index cf26c0f8eec7..5f220cd98810 100644 --- a/compiler/src/dotty/tools/repl/ReplDriver.scala +++ b/compiler/src/dotty/tools/repl/ReplDriver.scala @@ -13,7 +13,6 @@ import dotty.tools.dotc.core.NameOps._ import dotty.tools.dotc.core.Names.Name import dotty.tools.dotc.core.StdNames._ import dotty.tools.dotc.core.Symbols.{Symbol, defn} -import dotty.tools.dotc.core.Types._ import dotty.tools.dotc.interactive.Interactive import dotty.tools.dotc.printing.SyntaxHighlighting import dotty.tools.dotc.reporting.MessageRendering diff --git a/compiler/src/dotty/tools/repl/package.scala b/compiler/src/dotty/tools/repl/package.scala index c79535a5c7e5..9e9d4c24bb5c 100644 --- a/compiler/src/dotty/tools/repl/package.scala +++ b/compiler/src/dotty/tools/repl/package.scala @@ -2,7 +2,6 @@ package dotty.tools import dotc.core.Contexts.Context import dotc.core.Symbols.Symbol -import dotc.reporting.diagnostic.MessageContainer import dotc.printing.ReplPrinter import dotc.reporting.{HideNonSensicalMessages, StoreReporter, UniqueMessagePositions} From 3c44403c800bfeb019e6a734d4f1809e0b6ed456 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Thu, 4 Oct 2018 19:52:02 +0200 Subject: [PATCH 3/7] Add explicit return types to public members Using a published local version of RscCompat --- compiler/sjs/backend/sjs/JSCodeGen.scala | 4 +- compiler/sjs/backend/sjs/JSEncoding.scala | 4 +- compiler/sjs/backend/sjs/JSPositions.scala | 4 +- .../backend/jvm/CollectEntryPoints.scala | 2 +- .../backend/jvm/DottyBackendInterface.scala | 62 +- .../dotty/tools/backend/jvm/GenBCode.scala | 21 +- .../dotty/tools/dotc/CompilationUnit.scala | 6 +- compiler/src/dotty/tools/dotc/Compiler.scala | 4 +- compiler/src/dotty/tools/dotc/Driver.scala | 4 +- compiler/src/dotty/tools/dotc/Resident.scala | 2 +- compiler/src/dotty/tools/dotc/Run.scala | 6 +- .../src/dotty/tools/dotc/ast/Desugar.scala | 32 +- .../dotty/tools/dotc/ast/DesugarEnums.scala | 8 +- .../src/dotty/tools/dotc/ast/Positioned.scala | 2 +- .../src/dotty/tools/dotc/ast/TreeInfo.scala | 56 +- .../dotty/tools/dotc/ast/TreeTypeMap.scala | 6 +- compiler/src/dotty/tools/dotc/ast/Trees.scala | 103 +- compiler/src/dotty/tools/dotc/ast/tpd.scala | 30 +- compiler/src/dotty/tools/dotc/ast/untpd.scala | 114 +-- .../dotc/classpath/AggregateClassPath.scala | 2 +- .../tools/dotc/classpath/ClassPath.scala | 8 +- .../dotc/classpath/ClassPathFactory.scala | 6 +- .../dotc/classpath/DirectoryClassPath.scala | 4 +- .../tools/dotc/classpath/FileUtils.scala | 4 +- .../dotc/classpath/ZipArchiveFileLookup.scala | 2 +- .../tools/dotc/config/CompilerCommand.scala | 6 +- .../tools/dotc/config/JavaPlatform.scala | 4 +- .../tools/dotc/config/PathResolver.scala | 89 +- .../dotty/tools/dotc/config/Properties.scala | 86 +- .../tools/dotc/config/ScalaSettings.scala | 240 ++--- .../tools/dotc/config/ScalaVersion.scala | 24 +- .../dotty/tools/dotc/config/Settings.scala | 30 +- .../tools/dotc/config/WrappedProperties.scala | 18 +- .../dotty/tools/dotc/core/Annotations.scala | 41 +- .../tools/dotc/core/CheckRealizable.scala | 8 +- .../src/dotty/tools/dotc/core/Comments.scala | 8 +- .../src/dotty/tools/dotc/core/Constants.scala | 65 +- .../tools/dotc/core/ConstraintHandling.scala | 4 +- .../tools/dotc/core/ConstraintRunInfo.scala | 6 +- .../src/dotty/tools/dotc/core/Contexts.scala | 126 +-- .../dotty/tools/dotc/core/Decorators.scala | 2 +- .../dotty/tools/dotc/core/Definitions.scala | 933 +++++++++--------- .../tools/dotc/core/DenotTransformers.scala | 2 +- .../dotty/tools/dotc/core/Denotations.scala | 61 +- .../src/dotty/tools/dotc/core/Flags.scala | 348 +++---- .../src/dotty/tools/dotc/core/Hashable.scala | 8 +- compiler/src/dotty/tools/dotc/core/Mode.scala | 60 +- .../src/dotty/tools/dotc/core/NameKinds.scala | 136 +-- .../src/dotty/tools/dotc/core/NameOps.scala | 26 +- .../src/dotty/tools/dotc/core/Names.scala | 112 +-- .../tools/dotc/core/OrderingConstraint.scala | 10 +- .../src/dotty/tools/dotc/core/Periods.scala | 18 +- .../src/dotty/tools/dotc/core/Phases.scala | 78 +- .../src/dotty/tools/dotc/core/Scopes.scala | 16 +- .../src/dotty/tools/dotc/core/Signature.scala | 14 +- .../src/dotty/tools/dotc/core/StdNames.scala | 32 +- .../dotty/tools/dotc/core/Substituters.scala | 10 +- .../tools/dotc/core/SymDenotations.scala | 130 +-- .../dotty/tools/dotc/core/SymbolLoaders.scala | 22 +- .../src/dotty/tools/dotc/core/Symbols.scala | 58 +- .../tools/dotc/core/TypeApplications.scala | 20 +- .../dotty/tools/dotc/core/TypeComparer.scala | 74 +- .../dotty/tools/dotc/core/TypeErasure.scala | 6 +- .../dotty/tools/dotc/core/TypeErrors.scala | 6 +- .../src/dotty/tools/dotc/core/TypeOps.scala | 16 +- .../dotty/tools/dotc/core/TyperState.scala | 20 +- .../src/dotty/tools/dotc/core/Types.scala | 462 ++++----- .../core/classfile/ClassfileConstants.scala | 8 +- .../dotc/core/classfile/ClassfileParser.scala | 20 +- .../dotc/core/quoted/QuoteUnpickler.scala | 2 +- .../dotc/core/tasty/CommentUnpickler.scala | 2 +- .../dotc/core/tasty/DottyUnpickler.scala | 8 +- .../dotc/core/tasty/PositionPickler.scala | 6 +- .../dotc/core/tasty/PositionUnpickler.scala | 7 +- .../tools/dotc/core/tasty/TastyBuffer.scala | 10 +- .../tools/dotc/core/tasty/TastyFormat.scala | 18 +- .../tools/dotc/core/tasty/TastyPickler.scala | 6 +- .../tools/dotc/core/tasty/TastyPrinter.scala | 4 +- .../tools/dotc/core/tasty/TastyReader.scala | 8 +- .../dotc/core/tasty/TastyUnpickler.scala | 6 +- .../tools/dotc/core/tasty/TreeBuffer.scala | 4 +- .../tools/dotc/core/tasty/TreePickler.scala | 18 +- .../tools/dotc/core/tasty/TreeUnpickler.scala | 10 +- .../core/unpickleScala2/PickleBuffer.scala | 8 +- .../core/unpickleScala2/PickleFormat.scala | 4 +- .../core/unpickleScala2/Scala2Unpickler.scala | 28 +- .../fromtasty/ReadTastyTreesFromClasses.scala | 2 +- .../dotc/fromtasty/TASTYCompilationUnit.scala | 2 +- .../dotty/tools/dotc/fromtasty/TASTYRun.scala | 2 +- .../tools/dotc/interactive/Interactive.scala | 12 +- .../dotc/interactive/InteractiveDriver.scala | 4 +- .../tools/dotc/parsing/CharArrayReader.scala | 16 +- .../tools/dotc/parsing/JavaParsers.scala | 24 +- .../tools/dotc/parsing/JavaScanners.scala | 6 +- .../dotty/tools/dotc/parsing/JavaTokens.scala | 10 +- .../dotty/tools/dotc/parsing/Parsers.scala | 118 +-- .../dotty/tools/dotc/parsing/Scanners.scala | 29 +- .../src/dotty/tools/dotc/parsing/Tokens.scala | 58 +- .../dotty/tools/dotc/parsing/package.scala | 6 +- .../dotc/parsing/xml/MarkupParserCommon.scala | 8 +- .../dotc/parsing/xml/MarkupParsers.scala | 22 +- .../dotc/parsing/xml/SymbolicXMLBuilder.scala | 20 +- .../tools/dotc/parsing/xml/Utility.scala | 6 +- .../tools/dotc/printing/Highlighting.scala | 10 +- .../tools/dotc/printing/PlainPrinter.scala | 20 +- .../dotty/tools/dotc/printing/Printer.scala | 8 +- .../dotty/tools/dotc/printing/Printers.scala | 2 +- .../tools/dotc/printing/RefinedPrinter.scala | 20 +- .../dotc/printing/SyntaxHighlighting.scala | 16 +- .../src/dotty/tools/dotc/printing/Texts.scala | 20 +- .../dotty/tools/dotc/printing/package.scala | 16 +- .../dotty/tools/dotc/profile/Profiler.scala | 53 +- .../dotc/quoted/ExprCompilationUnit.scala | 2 +- .../tools/dotc/quoted/QuoteCompiler.scala | 2 +- .../dotc/quoted/TypeCompilationUnit.scala | 2 +- .../dotty/tools/dotc/reporting/Reporter.scala | 22 +- .../tools/dotc/reporting/StoreReporter.scala | 2 +- .../dotc/reporting/diagnostic/Message.scala | 28 +- .../diagnostic/MessageContainer.scala | 10 +- .../dotc/reporting/diagnostic/messages.scala | 760 +++++++------- .../dotty/tools/dotc/rewrites/Rewrites.scala | 2 +- .../src/dotty/tools/dotc/sbt/ExtractAPI.scala | 8 +- .../tools/dotc/sbt/ExtractDependencies.scala | 4 +- .../src/dotty/tools/dotc/sbt/ShowAPI.scala | 8 +- .../dotc/tastyreflect/ContextOpsImpl.scala | 3 +- .../dotc/tastyreflect/PatternOpsImpl.scala | 4 +- .../dotc/tastyreflect/PrintersImpl.scala | 16 +- .../dotc/tastyreflect/QuotedOpsImpl.scala | 8 +- .../tools/dotc/tastyreflect/TreeOpsImpl.scala | 2 +- .../tastyreflect/TypeOrBoundsOpsImpl.scala | 8 +- .../TypeOrBoundsTreesOpsImpl.scala | 2 +- .../tools/dotc/tastyreflect/package.scala | 4 +- .../tools/dotc/transform/AccessProxies.scala | 4 +- .../dotc/transform/AugmentScala2Traits.scala | 8 +- .../dotty/tools/dotc/transform/Bridges.scala | 7 +- .../tools/dotc/transform/ByNameClosures.scala | 2 +- .../tools/dotc/transform/CapturedVars.scala | 6 +- .../tools/dotc/transform/CheckReentrant.scala | 4 +- .../tools/dotc/transform/CheckStatic.scala | 4 +- .../dotc/transform/CollectEntryPoints.scala | 4 +- .../transform/CollectNullableFields.scala | 12 +- .../tools/dotc/transform/Constructors.scala | 6 +- .../tools/dotc/transform/CookComments.scala | 2 +- .../tools/dotc/transform/ElimByName.scala | 4 +- .../dotc/transform/ElimErasedValueType.scala | 4 +- .../dotc/transform/ElimOuterSelect.scala | 4 +- .../tools/dotc/transform/ElimRepeated.scala | 6 +- .../dotty/tools/dotc/transform/Erasure.scala | 32 +- .../tools/dotc/transform/ExpandPrivate.scala | 10 +- .../tools/dotc/transform/ExpandSAMs.scala | 2 +- .../tools/dotc/transform/ExplicitOuter.scala | 8 +- .../tools/dotc/transform/ExplicitSelf.scala | 4 +- .../dotc/transform/ExtensionMethods.scala | 8 +- .../tools/dotc/transform/FirstTransform.scala | 22 +- .../dotty/tools/dotc/transform/Flatten.scala | 16 +- .../dotc/transform/FunctionalInterfaces.scala | 16 +- .../dotty/tools/dotc/transform/GetClass.scala | 2 +- .../dotty/tools/dotc/transform/Getters.scala | 4 +- .../tools/dotc/transform/HoistSuperArgs.scala | 8 +- .../dotc/transform/InterceptedMethods.scala | 2 +- .../tools/dotc/transform/LambdaLift.scala | 34 +- .../dotty/tools/dotc/transform/LazyVals.scala | 66 +- .../dotty/tools/dotc/transform/LiftTry.scala | 12 +- .../dotc/transform/LinkScala2Impls.scala | 8 +- .../tools/dotc/transform/MacroTransform.scala | 4 +- .../MacroTransformWithImplicits.scala | 2 +- .../tools/dotc/transform/MegaPhase.scala | 74 +- .../dotty/tools/dotc/transform/Memoize.scala | 6 +- .../dotty/tools/dotc/transform/Mixin.scala | 10 +- .../dotty/tools/dotc/transform/MixinOps.scala | 11 +- .../tools/dotc/transform/MoveStatics.scala | 4 +- .../dotc/transform/NonLocalReturns.scala | 6 +- .../tools/dotc/transform/PatternMatcher.scala | 23 +- .../dotty/tools/dotc/transform/Pickler.scala | 2 +- .../tools/dotc/transform/PostTyper.scala | 16 +- .../dotc/transform/PrimitiveForwarders.scala | 6 +- .../dotc/transform/ProtectedAccessors.scala | 6 +- .../dotc/transform/PruneErasedDefs.scala | 14 +- .../tools/dotc/transform/ReifyQuotes.scala | 2 +- .../tools/dotc/transform/RenameLifted.scala | 2 +- .../tools/dotc/transform/ResolveSuper.scala | 10 +- .../tools/dotc/transform/RestoreScopes.scala | 6 +- .../tools/dotc/transform/SeqLiterals.scala | 4 +- .../dotc/transform/ShortcutImplicits.scala | 16 +- .../dotty/tools/dotc/transform/Splitter.scala | 8 +- .../tools/dotc/transform/SuperAccessors.scala | 6 +- .../dotty/tools/dotc/transform/SymUtils.scala | 4 +- .../dotc/transform/SyntheticMethods.scala | 8 +- .../dotty/tools/dotc/transform/TailRec.scala | 12 +- .../dotc/transform/TransformByNameApply.scala | 4 +- .../dotc/transform/TransformWildcards.scala | 2 +- .../tools/dotc/transform/TreeChecker.scala | 50 +- .../dotc/transform/TryCatchPatterns.scala | 2 +- .../dotc/transform/VCElideAllocations.scala | 2 +- .../dotc/transform/VCInlineMethods.scala | 2 +- .../tools/dotc/transform/ValueClasses.scala | 2 +- .../tools/dotc/transform/patmat/Space.scala | 2 +- .../dotty/tools/dotc/typer/Applications.scala | 72 +- .../src/dotty/tools/dotc/typer/Checking.scala | 24 +- .../tools/dotc/typer/ErrorReporting.scala | 12 +- .../dotty/tools/dotc/typer/EtaExpansion.scala | 12 +- .../src/dotty/tools/dotc/typer/FrontEnd.scala | 18 +- .../dotty/tools/dotc/typer/Implicits.scala | 32 +- .../dotty/tools/dotc/typer/ImportInfo.scala | 9 +- .../dotty/tools/dotc/typer/Inferencing.scala | 8 +- .../src/dotty/tools/dotc/typer/Inliner.scala | 20 +- .../src/dotty/tools/dotc/typer/Namer.scala | 46 +- .../tools/dotc/typer/PrepareInlineable.scala | 19 +- .../dotty/tools/dotc/typer/ProtoTypes.scala | 64 +- .../src/dotty/tools/dotc/typer/ReTyper.scala | 10 +- .../dotty/tools/dotc/typer/RefChecks.scala | 24 +- .../dotty/tools/dotc/typer/TypeAssigner.scala | 82 +- .../src/dotty/tools/dotc/typer/Typer.scala | 42 +- .../tools/dotc/typer/VarianceChecker.scala | 2 +- .../dotty/tools/dotc/typer/Variances.scala | 10 +- .../dotty/tools/dotc/util/Attachment.scala | 2 +- .../src/dotty/tools/dotc/util/Chars.scala | 16 +- .../tools/dotc/util/CommentParsing.scala | 4 +- .../src/dotty/tools/dotc/util/DiffUtil.scala | 4 +- .../tools/dotc/util/FreshNameCreator.scala | 4 +- .../src/dotty/tools/dotc/util/HashSet.scala | 8 +- .../src/dotty/tools/dotc/util/LRUCache.scala | 16 +- .../tools/dotc/util/NameTransformer.scala | 2 +- .../src/dotty/tools/dotc/util/Positions.scala | 44 +- compiler/src/dotty/tools/dotc/util/Set.scala | 2 +- .../dotty/tools/dotc/util/ShowPickled.scala | 16 +- .../tools/dotc/util/SimpleIdentityMap.scala | 58 +- .../tools/dotc/util/SimpleIdentitySet.scala | 8 +- .../tools/dotc/util/SixteenNibbles.scala | 4 +- .../dotty/tools/dotc/util/SourceFile.scala | 26 +- .../tools/dotc/util/SourcePosition.scala | 10 +- .../src/dotty/tools/dotc/util/Stats.scala | 18 +- compiler/src/dotty/tools/dotc/util/Util.scala | 2 +- .../dotty/tools/dotc/util/WeakHashSet.scala | 16 +- .../src/dotty/tools/dotc/util/common.scala | 9 +- .../src/dotty/tools/io/AbstractFile.scala | 8 +- compiler/src/dotty/tools/io/ClassPath.scala | 2 +- compiler/src/dotty/tools/io/File.scala | 19 +- compiler/src/dotty/tools/io/Jar.scala | 25 +- .../src/dotty/tools/io/NoAbstractFile.scala | 4 +- compiler/src/dotty/tools/io/Path.scala | 50 +- compiler/src/dotty/tools/io/PlainFile.scala | 21 +- compiler/src/dotty/tools/io/Streamable.scala | 6 +- .../src/dotty/tools/io/VirtualDirectory.scala | 22 +- compiler/src/dotty/tools/io/VirtualFile.scala | 8 +- compiler/src/dotty/tools/io/ZipArchive.scala | 60 +- compiler/src/dotty/tools/package.scala | 2 +- .../tools/repl/CollectTopLevelImports.scala | 4 +- .../src/dotty/tools/repl/JLineTerminal.scala | 2 +- .../src/dotty/tools/repl/ParseResult.scala | 16 +- .../src/dotty/tools/repl/ReplDriver.scala | 4 +- .../src/dotty/tools/repl/ReplFrontEnd.scala | 4 +- .../reflect/internal/pickling/package.scala | 6 +- compiler/src/scala/tools/nsc/io/package.scala | 10 +- .../tools/dottydoc/model/factories.scala | 2 +- library/src/dotty/runtime/LazyVals.scala | 1 - 256 files changed, 3617 insertions(+), 3608 deletions(-) diff --git a/compiler/sjs/backend/sjs/JSCodeGen.scala b/compiler/sjs/backend/sjs/JSCodeGen.scala index 09f6d07b563e..1d6c538e6fdc 100644 --- a/compiler/sjs/backend/sjs/JSCodeGen.scala +++ b/compiler/sjs/backend/sjs/JSCodeGen.scala @@ -1704,7 +1704,7 @@ class JSCodeGen()(implicit ctx: Context) { nme.UNARY_! -> js.JSUnaryOp.! ) - def unapply(name: Names.TermName): Option[js.JSUnaryOp.Code] = + def unapply(name: TermName): Option[js.JSUnaryOp.Code] = map.get(name) } @@ -1732,7 +1732,7 @@ class JSCodeGen()(implicit ctx: Context) { nme.ZOR -> js.JSBinaryOp.|| ) - def unapply(name: Names.TermName): Option[js.JSBinaryOp.Code] = + def unapply(name: TermName): Option[js.JSBinaryOp.Code] = map.get(name) } diff --git a/compiler/sjs/backend/sjs/JSEncoding.scala b/compiler/sjs/backend/sjs/JSEncoding.scala index e8ea3258bfa2..8644cdaf5760 100644 --- a/compiler/sjs/backend/sjs/JSEncoding.scala +++ b/compiler/sjs/backend/sjs/JSEncoding.scala @@ -39,11 +39,11 @@ object JSEncoding { private final val ScalaJSEnvironmentName = "ScalaJS" implicit class SymOps(val self: Symbol) extends AnyVal { - def unexpandedName(implicit ctx: Context): Names.Name = + def unexpandedName(implicit ctx: Context): Name = self.name.unexpandedName } - implicit class MyNameOps(val self: Names.Name) extends AnyVal { + implicit class MyNameOps(val self: Name) extends AnyVal { def decoded: String = self.decode.toString } diff --git a/compiler/sjs/backend/sjs/JSPositions.scala b/compiler/sjs/backend/sjs/JSPositions.scala index 10570da00129..019b87f32818 100644 --- a/compiler/sjs/backend/sjs/JSPositions.scala +++ b/compiler/sjs/backend/sjs/JSPositions.scala @@ -11,7 +11,7 @@ import org.scalajs.core.ir class JSPositions()(implicit ctx: Context) { /** Implicit conversion from dotty Position to ir.Position. */ - implicit def pos2irPos(pos: Positions.Position): ir.Position = { + implicit def pos2irPos(pos: Position): ir.Position = { if (!pos.exists) ir.Position.NoPosition else { val source = pos2irPosCache.toIRSource(ctx.compilationUnit.source) @@ -23,7 +23,7 @@ class JSPositions()(implicit ctx: Context) { /** Implicitly materializes an ir.Position from an implicit dotty Position. */ implicit def implicitPos2irPos( - implicit pos: Positions.Position): ir.Position = { + implicit pos: Position): ir.Position = { pos2irPos(pos) } diff --git a/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala b/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala index b8363a9f79c2..a2d178e70c49 100644 --- a/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala +++ b/compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala @@ -31,7 +31,7 @@ class CollectEntryPoints extends MiniPhase { } object CollectEntryPoints{ - def isJavaMainMethod(sym: Symbol)(implicit ctx: Context) = { + def isJavaMainMethod(sym: Symbol)(implicit ctx: Context): Boolean = { (sym.name == nme.main) && (sym.info match { case r@MethodTpe(_, List(defn.ArrayOf(t)), _) => (t.widenDealias =:= defn.StringType) && ( diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index c9a61eac7b1c..b0bf22671f43 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -28,7 +28,7 @@ import tpd._ import scala.tools.asm import StdNames.{nme, str} import NameKinds.{DefaultGetterName, ExpandedName} - +import Names.TermName class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Map[Symbol, Set[ClassSymbol]])(implicit ctx: Context) extends BackendInterface{ import Symbols.{toDenot, toClassDenot} @@ -76,7 +76,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma type LabelDef = tpd.DefDef type Closure = tpd.Closure - val NoSymbol = Symbols.NoSymbol + val NoSymbol: Symbols.NoSymbol.type = Symbols.NoSymbol val NoPosition: Position = Positions.NoPosition val EmptyTree: Tree = tpd.EmptyTree @@ -104,11 +104,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val nme_EQEQ_LOCAL_VAR: Name = StdNames.nme.EQEQ_LOCAL_VAR // require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always. - override lazy val LambdaMetaFactory = ctx.requiredClass("java.lang.invoke.LambdaMetafactory") - override lazy val MethodHandle = ctx.requiredClass("java.lang.invoke.MethodHandle") + override lazy val LambdaMetaFactory: ClassSymbol = ctx.requiredClass("java.lang.invoke.LambdaMetafactory") + override lazy val MethodHandle: ClassSymbol = ctx.requiredClass("java.lang.invoke.MethodHandle") val nme_valueOf: Name = StdNames.nme.valueOf - val nme_apply = StdNames.nme.apply + val nme_apply: TermName = StdNames.nme.apply val NothingClass: Symbol = defn.NothingClass val NullClass: Symbol = defn.NullClass val ObjectClass: Symbol = defn.ObjectClass @@ -128,7 +128,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val LongClass: Symbol = defn.LongClass val FloatClass: Symbol = defn.FloatClass val DoubleClass: Symbol = defn.DoubleClass - def isArrayClone(tree: Tree) = tree match { + def isArrayClone(tree: Tree): Boolean = tree match { case Select(qual, StdNames.nme.clone_) if qual.tpe.widen.isInstanceOf[JavaArrayType] => true case _ => false } @@ -146,11 +146,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val String_valueOf: Symbol = defn.String_valueOf_Object lazy val Predef_classOf: Symbol = defn.ScalaPredefModule.requiredMethod(nme.classOf) - lazy val AnnotationRetentionAttr = ctx.requiredClass("java.lang.annotation.Retention") - lazy val AnnotationRetentionSourceAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE") - lazy val AnnotationRetentionClassAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS") - lazy val AnnotationRetentionRuntimeAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME") - lazy val JavaAnnotationClass = ctx.requiredClass("java.lang.annotation.Annotation") + lazy val AnnotationRetentionAttr: ClassSymbol = ctx.requiredClass("java.lang.annotation.Retention") + lazy val AnnotationRetentionSourceAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE") + lazy val AnnotationRetentionClassAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS") + lazy val AnnotationRetentionRuntimeAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME") + lazy val JavaAnnotationClass: ClassSymbol = ctx.requiredClass("java.lang.annotation.Annotation") def boxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses().map{x => // @darkdimius Are you sure this should be a def? (x, Erasure.Boxing.boxMethod(x.asClass)) @@ -158,7 +158,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma def unboxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses().map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap - override def isSyntheticArrayConstructor(s: Symbol) = { + override def isSyntheticArrayConstructor(s: Symbol): Boolean = { s eq defn.newArrayMethod } @@ -309,7 +309,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } override def emitAnnotations(cw: asm.ClassVisitor, annotations: List[Annotation], bcodeStore: BCodeHelpers) - (innerClasesStore: bcodeStore.BCInnerClassGen) = { + (innerClasesStore: bcodeStore.BCInnerClassGen): Unit = { for(annot <- annotations; if shouldEmitAnnotation(annot)) { val typ = annot.atp val assocs = annot.assocs @@ -326,7 +326,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } override def emitAnnotations(mw: asm.MethodVisitor, annotations: List[Annotation], bcodeStore: BCodeHelpers) - (innerClasesStore: bcodeStore.BCInnerClassGen) = { + (innerClasesStore: bcodeStore.BCInnerClassGen): Unit = { for(annot <- annotations; if shouldEmitAnnotation(annot)) { val typ = annot.atp val assocs = annot.assocs @@ -336,7 +336,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } override def emitAnnotations(fw: asm.FieldVisitor, annotations: List[Annotation], bcodeStore: BCodeHelpers) - (innerClasesStore: bcodeStore.BCInnerClassGen) = { + (innerClasesStore: bcodeStore.BCInnerClassGen): Unit = { for(annot <- annotations; if shouldEmitAnnotation(annot)) { val typ = annot.atp val assocs = annot.assocs @@ -392,7 +392,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma def emitAsmp: Option[String] = None - def shouldEmitJumpAfterLabels = true + def shouldEmitJumpAfterLabels: Boolean = true def dumpClasses: Option[String] = if (ctx.settings.Ydumpclasses.isDefault) None @@ -420,7 +420,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val MODULE_INSTANCE_FIELD: String = str.MODULE_INSTANCE_FIELD - def dropModule(str: String) = + def dropModule(str: String): String = if (!str.isEmpty && str.last == '$') str.take(str.length - 1) else str def newTermName(prefix: String): Name = prefix.toTermName @@ -471,7 +471,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } // todo: remove - def isMaybeBoxed(sym: Symbol) = { + def isMaybeBoxed(sym: Symbol): Boolean = { (sym == ObjectClass) || (sym == JavaSerializableClass) || (sym == defn.ComparableClass) || @@ -1047,13 +1047,13 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma // todo: this product1s should also eventually become name-based pattn matching object Literal extends LiteralDeconstructor { - def get = field.const + def get: Constant = field.const } object Throw extends ThrowDeconstructor { - def get = field.args.head + def get: Tree = field.args.head - override def unapply(s: Throw): DottyBackendInterface.this.Throw.type = { + override def unapply(s: Throw): Throw.type = { if (s.fun.symbol eq defn.throwMethod) { field = s } else { @@ -1064,11 +1064,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } object New extends NewDeconstructor { - def get = field.tpt.tpe + def get: Type = field.tpt.tpe } object This extends ThisDeconstructor { - def get = field.qual.name + def get: Name = field.qual.name def apply(s: Symbol): This = tpd.This(s.asClass) } @@ -1088,15 +1088,15 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } object Ident extends IdentDeconstructor { - def get = field.name + def get: Name = field.name } object Alternative extends AlternativeDeconstructor { - def get = field.trees + def get: List[Tree] = field.trees } object Constant extends ConstantDeconstructor { - def get = field.value + def get: Any = field.value } object ThrownException extends ThrownException { def unapply(a: Annotation): Option[Symbol] = None // todo @@ -1113,7 +1113,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma def _2: List[Symbol] = field.vparamss.flatMap(_.map(_.symbol)) def _3: Tree = field.rhs - override def unapply(s: LabelDef): DottyBackendInterface.this.LabelDef.type = { + override def unapply(s: LabelDef): LabelDef.type = { if (s.symbol is Flags.Label) this.field = s else this.field = null this @@ -1191,9 +1191,9 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } object Closure extends ClosureDeconstructor { - def _1 = field.env - def _2 = field.meth - def _3 = { + def _1: List[Tree] = field.env + def _2: Tree = field.meth + def _3: Symbol = { val t = field.tpt.tpe.typeSymbol if (t.exists) t else { @@ -1206,5 +1206,5 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } } - def currentUnit = ctx.compilationUnit + def currentUnit: CompilationUnit = ctx.compilationUnit } diff --git a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala index 7ad6b9e74d62..48c20b4f1cf5 100644 --- a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala @@ -10,6 +10,7 @@ import scala.tools.asm.CustomAttr import scala.tools.nsc.backend.jvm._ import dotty.tools.dotc.transform.SymUtils._ import dotty.tools.dotc.interfaces +import dotty.tools.dotc.util.SourceFile import java.util.Optional import dotty.tools.dotc.core._ @@ -31,10 +32,10 @@ import dotty.tools.io._ class GenBCode extends Phase { def phaseName: String = GenBCode.name private val entryPoints = new mutable.HashSet[Symbol]() - def registerEntryPoint(sym: Symbol) = entryPoints += sym + def registerEntryPoint(sym: Symbol): mutable.HashSet[Symbol] = entryPoints += sym private val superCallsMap = newMutableSymbolMap[Set[ClassSymbol]] - def registerSuperCall(sym: Symbol, calls: ClassSymbol) = { + def registerSuperCall(sym: Symbol, calls: ClassSymbol): Unit = { val old = superCallsMap.getOrElse(sym, Set.empty) superCallsMap.update(sym, old + calls) } @@ -53,7 +54,7 @@ class GenBCode extends Phase { entryPoints.clear() } - override def runOn(units: List[CompilationUnit])(implicit ctx: Context) = { + override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = { try super.runOn(units) finally myOutput match { case jar: JarArchive => @@ -71,7 +72,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter var tree: Tree = _ - val sourceFile = ctx.compilationUnit.source + val sourceFile: SourceFile = ctx.compilationUnit.source /** Convert a `dotty.tools.io.AbstractFile` into a * `dotty.tools.dotc.interfaces.AbstractFile`. @@ -94,7 +95,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter /* ---------------- q1 ---------------- */ case class Item1(arrivalPos: Int, cd: TypeDef, cunit: CompilationUnit) { - def isPoison = { arrivalPos == Int.MaxValue } + def isPoison: Boolean = { arrivalPos == Int.MaxValue } } private val poison1 = Item1(Int.MaxValue, null, ctx.compilationUnit) private val q1 = new java.util.LinkedList[Item1] @@ -107,7 +108,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter case class Item2(arrivalPos: Int, mirror: SubItem2, plain: SubItem2) { - def isPoison = { arrivalPos == Int.MaxValue } + def isPoison: Boolean = { arrivalPos == Int.MaxValue } } private val poison2 = Item2(Int.MaxValue, null, null) @@ -132,7 +133,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter mirror: SubItem3, plain: SubItem3) { - def isPoison = { arrivalPos == Int.MaxValue } + def isPoison: Boolean = { arrivalPos == Int.MaxValue } } private val i3comparator = new java.util.Comparator[Item3] { override def compare(a: Item3, b: Item3) = { @@ -191,7 +192,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter * enqueues them in queue-2. * */ - def visit(item: Item1) = { + def visit(item: Item1): Boolean = { val Item1(arrivalPos, cd, cunit) = item val claszSymbol = cd.symbol @@ -350,7 +351,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter } // end of class BCodePhase.Worker2 - var arrivalPos = 0 + var arrivalPos: Int = 0 /* * A run of the BCodePhase phase comprises: @@ -363,7 +364,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter * (c) tear down (closing the classfile-writer and clearing maps) * */ - def run(t: Tree) = { + def run(t: Tree): Unit = { this.tree = t // val bcodeStart = Statistics.startTimer(BackendStats.bcodeTimer) diff --git a/compiler/src/dotty/tools/dotc/CompilationUnit.scala b/compiler/src/dotty/tools/dotc/CompilationUnit.scala index 210894277f92..4cbd228c02a2 100644 --- a/compiler/src/dotty/tools/dotc/CompilationUnit.scala +++ b/compiler/src/dotty/tools/dotc/CompilationUnit.scala @@ -12,13 +12,13 @@ import dotty.tools.dotc.transform.SymUtils._ class CompilationUnit(val source: SourceFile) { - override def toString = source.toString + override def toString: String = source.toString var untpdTree: untpd.Tree = untpd.EmptyTree var tpdTree: tpd.Tree = tpd.EmptyTree - def isJava = source.file.name.endsWith(".java") + def isJava: Boolean = source.file.name.endsWith(".java") /** Pickled TASTY binaries, indexed by class. */ var pickled: Map[ClassSymbol, Array[Byte]] = Map() @@ -29,7 +29,7 @@ class CompilationUnit(val source: SourceFile) { var containsQuotesOrSplices: Boolean = false /** A structure containing a temporary map for generating inline accessors */ - val inlineAccessors = new InlineAccessors + val inlineAccessors: InlineAccessors = new InlineAccessors } object CompilationUnit { diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index d3d03b8d98ae..17bf78e54a50 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -118,8 +118,8 @@ class Compiler { List(new GenBCode) :: // Generate JVM bytecode Nil - var runId = 1 - def nextRunId = { + var runId: Int = 1 + def nextRunId: Int = { runId += 1; runId } diff --git a/compiler/src/dotty/tools/dotc/Driver.scala b/compiler/src/dotty/tools/dotc/Driver.scala index f67ee91c5776..e3d303807619 100644 --- a/compiler/src/dotty/tools/dotc/Driver.scala +++ b/compiler/src/dotty/tools/dotc/Driver.scala @@ -37,9 +37,9 @@ class Driver { } else ctx.reporter - protected def initCtx = (new ContextBase).initialCtx + protected def initCtx: Context = (new ContextBase).initialCtx - protected def sourcesRequired = true + protected def sourcesRequired: Boolean = true def setup(args: Array[String], rootCtx: Context): (List[String], Context) = { val ctx = rootCtx.fresh diff --git a/compiler/src/dotty/tools/dotc/Resident.scala b/compiler/src/dotty/tools/dotc/Resident.scala index 7f6c288cc892..0b971dd05953 100644 --- a/compiler/src/dotty/tools/dotc/Resident.scala +++ b/compiler/src/dotty/tools/dotc/Resident.scala @@ -27,7 +27,7 @@ class Resident extends Driver { object residentCompiler extends Compiler - override def sourcesRequired = false + override def sourcesRequired: Boolean = false private val quit = ":q" private val reset = ":reset" diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index 4e7568623b38..f7e88c124b57 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -64,7 +64,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint private[this] var myCtx = rootContext(ictx) /** The context created for this run */ - def runContext = myCtx + def runContext: Context = myCtx protected[this] implicit def ctx: Context = myCtx assert(ctx.runId <= Periods.MaxPossibleRunId) @@ -128,7 +128,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint * or we need to assemble phases on each run, and take -Yskip, -Ystop into * account. I think the latter would be preferable. */ - def compileSources(sources: List[SourceFile]) = + def compileSources(sources: List[SourceFile]): Unit = if (sources forall (_.exists)) { units = sources map (new CompilationUnit(_)) compileUnits() @@ -264,7 +264,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint r } - override def reset() = { + override def reset(): Unit = { super[ImplicitRunInfo].reset() super[ConstraintRunInfo].reset() myCtx = null diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 221b6d764cf2..1a223f6e8d08 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -37,15 +37,15 @@ object desugar { // ----- DerivedTypeTrees ----------------------------------- class SetterParamTree extends DerivedTypeTree { - def derivedTree(sym: Symbol)(implicit ctx: Context) = tpd.TypeTree(sym.info.resultType) + def derivedTree(sym: Symbol)(implicit ctx: Context): tpd.TypeTree = tpd.TypeTree(sym.info.resultType) } class TypeRefTree extends DerivedTypeTree { - def derivedTree(sym: Symbol)(implicit ctx: Context) = tpd.TypeTree(sym.typeRef) + def derivedTree(sym: Symbol)(implicit ctx: Context): tpd.TypeTree = tpd.TypeTree(sym.typeRef) } class TermRefTree extends DerivedTypeTree { - def derivedTree(sym: Symbol)(implicit ctx: Context) = tpd.ref(sym) + def derivedTree(sym: Symbol)(implicit ctx: Context): tpd.Tree = tpd.ref(sym) } /** A type tree that computes its type from an existing parameter. @@ -59,7 +59,7 @@ object desugar { * be completed so that OriginalSymbol attachments are pushed to DerivedTypeTrees * in apply/unapply methods. */ - override def ensureCompletions(implicit ctx: Context) = + override def ensureCompletions(implicit ctx: Context): Unit = if (!(ctx.owner is Package)) if (ctx.owner.isClass) { ctx.owner.ensureCompleted() @@ -81,7 +81,7 @@ object desugar { * * parameter name == reference name ++ suffix */ - def derivedTree(sym: Symbol)(implicit ctx: Context) = { + def derivedTree(sym: Symbol)(implicit ctx: Context): tpd.TypeTree = { val relocate = new TypeMap { val originalOwner = sym.owner def apply(tp: Type) = tp match { @@ -114,7 +114,7 @@ object desugar { TypeDef(sym.name, new DerivedFromParamTree("").watching(sym)).withFlags(TypeParam) /** A value definition copied from `vdef` with a tpt typetree derived from it */ - def derivedTermParam(vdef: ValDef) = + def derivedTermParam(vdef: ValDef): ValDef = cpy.ValDef(vdef)( tpt = new DerivedFromParamTree("") withPos vdef.tpt.pos watching vdef) @@ -150,7 +150,7 @@ object desugar { else vdef } - def makeImplicitParameters(tpts: List[Tree], forPrimaryConstructor: Boolean = false)(implicit ctx: Context) = + def makeImplicitParameters(tpts: List[Tree], forPrimaryConstructor: Boolean = false)(implicit ctx: Context): List[ValDef] = for (tpt <- tpts) yield { val paramFlags: FlagSet = if (forPrimaryConstructor) PrivateLocalParamAccessor else Param val epname = EvidenceParamName.fresh() @@ -609,7 +609,7 @@ object desugar { else cpy.ValDef(self)(tpt = selfType).withMods(self.mods | SelfName) } - val cdef1 = addEnumFlags { + val cdef1: DefTree = addEnumFlags { val originalTparamsIt = impliedTparams.toIterator val originalVparamsIt = originalVparamss.toIterator.flatten val tparamAccessors = derivedTparams.map(_.withMods(originalTparamsIt.next().mods)) @@ -621,10 +621,10 @@ object desugar { case _ => Nil } - cpy.TypeDef(cdef)( + cpy.TypeDef(cdef: TypeDef)( name = className, rhs = cpy.Template(impl)(constr, parents1, self1, - tparamAccessors ::: vparamAccessors ::: normalizedBody ::: caseClassMeths)) + tparamAccessors ::: vparamAccessors ::: normalizedBody ::: caseClassMeths)): TypeDef } // install the watch on classTycon @@ -636,7 +636,7 @@ object desugar { flatTree(cdef1 :: companions ::: implicitWrappers) } - val AccessOrSynthetic = AccessFlags | Synthetic + val AccessOrSynthetic: FlagSet = AccessFlags | Synthetic /** Expand * @@ -762,7 +762,7 @@ object desugar { } /** Expand variable identifier x to x @ _ */ - def patternVar(tree: Tree)(implicit ctx: Context) = { + def patternVar(tree: Tree)(implicit ctx: Context): Bind = { val Ident(name) = tree Bind(name, Ident(nme.WILDCARD)).withPos(tree.pos) } @@ -837,7 +837,7 @@ object desugar { * def $anonfun(params) = body * Closure($anonfun) */ - def makeClosure(params: List[ValDef], body: Tree, tpt: Tree = TypeTree(), isImplicit: Boolean)(implicit ctx: Context) = + def makeClosure(params: List[ValDef], body: Tree, tpt: Tree = TypeTree(), isImplicit: Boolean)(implicit ctx: Context): Block = Block( DefDef(nme.ANON_FUN, Nil, params :: Nil, tpt, body).withMods(synthetic | Artifact), Closure(Nil, Ident(nme.ANON_FUN), if (isImplicit) ImplicitEmptyTree else EmptyTree)) @@ -852,7 +852,7 @@ object desugar { * * (x$1, ..., x$n) => (x$0, ..., x${n-1} @unchecked) match { cases } */ - def makeCaseLambda(cases: List[CaseDef], nparams: Int = 1, unchecked: Boolean = true)(implicit ctx: Context) = { + def makeCaseLambda(cases: List[CaseDef], nparams: Int = 1, unchecked: Boolean = true)(implicit ctx: Context): Function = { val params = (1 to nparams).toList.map(makeSyntheticParameter(_)) val selector = makeTuple(params.map(p => Ident(p.name))) @@ -896,7 +896,7 @@ object desugar { * following `fullName`. This is necessary so that we avoid reading an annotation from * the classpath that is also compiled from source. */ - def makeAnnotated(fullName: String, tree: Tree)(implicit ctx: Context) = { + def makeAnnotated(fullName: String, tree: Tree)(implicit ctx: Context): Annotated = { val parts = fullName.split('.') val ttree = ctx.typerPhase match { case phase: FrontEnd if phase.stillToBeEntered(parts.last) => @@ -907,7 +907,7 @@ object desugar { case _ => TypeTree(ctx.requiredClass(fullName).typeRef) } - Annotated(tree, untpd.New(ttree, Nil)) + Annotated(tree, New(ttree, Nil)) } private def derivedValDef(original: Tree, named: NameTree, tpt: Tree, rhs: Tree, mods: Modifiers)(implicit ctx: Context) = { diff --git a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala index ee77e23e92a8..9594b9809368 100644 --- a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala +++ b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala @@ -16,11 +16,11 @@ object DesugarEnums { import untpd._ @sharable object CaseKind extends Enumeration { - val Simple, Object, Class = Value + val Simple, Object, Class: Value = Value } /** Attachment containing the number of enum cases and the smallest kind that was seen so far. */ - val EnumCaseCount = new Property.Key[(Int, CaseKind.Value)] + val EnumCaseCount: Property.Key[(Int, DesugarEnums.CaseKind.Value)] = new Property.Key[(Int, CaseKind.Value)] /** The enumeration class that belongs to an enum case. This works no matter * whether the case is still in the enum class or it has been transferred to the @@ -64,11 +64,11 @@ object DesugarEnums { } /** A type tree referring to `enumClass` */ - def enumClassRef(implicit ctx: Context) = + def enumClassRef(implicit ctx: Context): Tree = if (enumClass.exists) TypeTree(enumClass.typeRef) else TypeTree() /** Add implied flags to an enum class or an enum case */ - def addEnumFlags(cdef: TypeDef)(implicit ctx: Context) = + def addEnumFlags(cdef: TypeDef)(implicit ctx: Context): cdef.ThisTree[Untyped] = if (cdef.mods.isEnumClass) cdef.withMods(cdef.mods.withFlags(cdef.mods.flags | Abstract | Sealed)) else if (isEnumCase(cdef)) cdef.withMods(cdef.mods.withFlags(cdef.mods.flags | Final)) else cdef diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index 8e3839bb2b3c..9db97de44590 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -50,7 +50,7 @@ abstract class Positioned extends Product { * any checks of consistency with - or updates of - other positions. * Called from Unpickler when entering positions. */ - private[dotc] def setPosUnchecked(pos: Position) = curPos = pos + private[dotc] def setPosUnchecked(pos: Position): Unit = curPos = pos /** If any children of this node do not have positions, * fit their positions between the positions of the known subtrees diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala index bdb387fdf42d..4f59b51a9a53 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -24,7 +24,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => case _ => false } - def isOpAssign(tree: Tree) = unsplice(tree) match { + def isOpAssign(tree: Tree): Boolean = unsplice(tree) match { case Apply(fn, _ :: _) => unsplice(fn) match { case Select(_, name) if name.isOpAssignmentName => true @@ -120,7 +120,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => case _ => false } - def isSuperSelection(tree: Tree) = unsplice(tree) match { + def isSuperSelection(tree: Tree): Boolean = unsplice(tree) match { case Select(Super(_, _), _) => true case _ => false } @@ -161,7 +161,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => } /** Is name a left-associative operator? */ - def isLeftAssoc(operator: Name) = !operator.isEmpty && (operator.toSimpleName.last != ':') + def isLeftAssoc(operator: Name): Boolean = !operator.isEmpty && (operator.toSimpleName.last != ':') /** can this type be a type pattern? */ def mayBeTypePat(tree: Tree): Boolean = unsplice(tree) match { @@ -194,7 +194,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => }*/ /** Does this argument list end with an argument of the form : _* ? */ - def isWildcardStarArgList(trees: List[Tree])(implicit ctx: Context) = + def isWildcardStarArgList(trees: List[Tree])(implicit ctx: Context): Boolean = trees.nonEmpty && isWildcardStarArg(trees.last) /** Is the argument a wildcard argument of the form `_` or `x @ _`? @@ -205,28 +205,28 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => } /** Does this list contain a named argument tree? */ - def hasNamedArg(args: List[Any]) = args exists isNamedArg - val isNamedArg = (arg: Any) => arg.isInstanceOf[Trees.NamedArg[_]] + def hasNamedArg(args: List[Any]): Boolean = args exists isNamedArg + val isNamedArg: Any => Boolean = (arg: Any) => arg.isInstanceOf[Trees.NamedArg[_]] /** Is this pattern node a catch-all (wildcard or variable) pattern? */ - def isDefaultCase(cdef: CaseDef) = cdef match { + def isDefaultCase(cdef: CaseDef): Boolean = cdef match { case CaseDef(pat, EmptyTree, _) => isWildcardArg(pat) case _ => false } /** Is this pattern node a synthetic catch-all case, added during PartialFuction synthesis before we know * whether the user provided cases are exhaustive. */ - def isSyntheticDefaultCase(cdef: CaseDef) = unsplice(cdef) match { + def isSyntheticDefaultCase(cdef: CaseDef): Boolean = unsplice(cdef) match { case CaseDef(Bind(nme.DEFAULT_CASE, _), EmptyTree, _) => true case _ => false } /** Does this CaseDef catch Throwable? */ - def catchesThrowable(cdef: CaseDef)(implicit ctx: Context) = + def catchesThrowable(cdef: CaseDef)(implicit ctx: Context): Boolean = catchesAllOf(cdef, defn.ThrowableType) /** Does this CaseDef catch everything of a certain Type? */ - def catchesAllOf(cdef: CaseDef, threshold: Type)(implicit ctx: Context) = + def catchesAllOf(cdef: CaseDef, threshold: Type)(implicit ctx: Context): Boolean = isDefaultCase(cdef) || cdef.guard.isEmpty && { unbind(cdef.pat) match { @@ -236,7 +236,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => } /** Is this case guarded? */ - def isGuardedCase(cdef: CaseDef) = cdef.guard ne EmptyTree + def isGuardedCase(cdef: CaseDef): Boolean = cdef.guard ne EmptyTree /** The underlying pattern ignoring any bindings */ def unbind(x: Tree): Tree = unsplice(x) match { @@ -297,7 +297,7 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped] /** True iff definition is a val or def with no right-hand-side, or it * is an abstract typoe declaration */ - def lacksDefinition(mdef: MemberDef)(implicit ctx: Context) = mdef match { + def lacksDefinition(mdef: MemberDef)(implicit ctx: Context): Boolean = mdef match { case mdef: ValOrDefDef => mdef.unforcedRhs == EmptyTree && !mdef.name.isConstructorName && !mdef.mods.is(TermParamOrAccessor) case mdef: TypeDef => @@ -419,11 +419,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => private def minOf(l0: PurityLevel, ls: List[PurityLevel]) = (l0 /: ls)(_ min _) - def isSimplyPure(tree: Tree)(implicit ctx: Context) = exprPurity(tree) == SimplyPure - def isPureExpr(tree: Tree)(implicit ctx: Context) = exprPurity(tree) >= Pure - def isIdempotentExpr(tree: Tree)(implicit ctx: Context) = exprPurity(tree) >= Idempotent + def isSimplyPure(tree: Tree)(implicit ctx: Context): Boolean = exprPurity(tree) == SimplyPure + def isPureExpr(tree: Tree)(implicit ctx: Context): Boolean = exprPurity(tree) >= Pure + def isIdempotentExpr(tree: Tree)(implicit ctx: Context): Boolean = exprPurity(tree) >= Idempotent - def isPureBinding(tree: Tree)(implicit ctx: Context) = statPurity(tree) >= Pure + def isPureBinding(tree: Tree)(implicit ctx: Context): Boolean = statPurity(tree) >= Pure /** The purity level of this reference. * @return @@ -444,9 +444,9 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => else SimplyPure } - def isPureRef(tree: Tree)(implicit ctx: Context) = + def isPureRef(tree: Tree)(implicit ctx: Context): Boolean = refPurity(tree) == SimplyPure - def isIdempotentRef(tree: Tree)(implicit ctx: Context) = + def isIdempotentRef(tree: Tree)(implicit ctx: Context): Boolean = refPurity(tree) >= Idempotent /** If `tree` is a constant expression, its value as a Literal, @@ -509,7 +509,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => /** Is tree a reference to a mutable variable, or to a potential getter * that has a setter in the same class? */ - def isVariableOrGetter(tree: Tree)(implicit ctx: Context) = { + def isVariableOrGetter(tree: Tree)(implicit ctx: Context): Boolean = { def sym = tree.symbol def isVar = sym is Mutable def isGetter = @@ -617,7 +617,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => } /** Is this pattern node a catch-all or type-test pattern? */ - def isCatchCase(cdef: CaseDef)(implicit ctx: Context) = cdef match { + def isCatchCase(cdef: CaseDef)(implicit ctx: Context): Boolean = cdef match { case CaseDef(Typed(Ident(nme.WILDCARD), tpt), EmptyTree, _) => isSimpleThrowable(tpt.tpe) case CaseDef(Bind(_, Typed(Ident(nme.WILDCARD), tpt)), EmptyTree, _) => @@ -731,7 +731,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => /** The qualifier part of a Select or Ident. * For an Ident, this is the `This` of the current class. */ - def qualifier(tree: Tree)(implicit ctx: Context) = tree match { + def qualifier(tree: Tree)(implicit ctx: Context): Tree = tree match { case Select(qual, _) => qual case tree: Ident => desugarIdentPrefix(tree) case _ => This(ctx.owner.enclosingClass.asClass) @@ -740,7 +740,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => /** Is this a selection of a member of a structural type that is not a member * of an underlying class or trait? */ - def isStructuralTermSelect(tree: Tree)(implicit ctx: Context) = tree match { + def isStructuralTermSelect(tree: Tree)(implicit ctx: Context): Boolean = tree match { case tree: Select => def hasRefinement(qualtpe: Type): Boolean = qualtpe.dealias match { case RefinedType(parent, rname, rinfo) => @@ -793,12 +793,12 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => object TreeInfo { class PurityLevel(val x: Int) extends AnyVal { - def >= (that: PurityLevel) = x >= that.x - def min(that: PurityLevel) = new PurityLevel(x min that.x) + def >= (that: PurityLevel): Boolean = x >= that.x + def min(that: PurityLevel): PurityLevel = new PurityLevel(x min that.x) } - val SimplyPure = new PurityLevel(3) - val Pure = new PurityLevel(2) - val Idempotent = new PurityLevel(1) - val Impure = new PurityLevel(0) + val SimplyPure: PurityLevel = new PurityLevel(3) + val Pure: PurityLevel = new PurityLevel(2) + val Idempotent: PurityLevel = new PurityLevel(1) + val Impure: PurityLevel = new PurityLevel(0) } diff --git a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala index fee85dcb10ce..25269c17e863 100644 --- a/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -42,7 +42,7 @@ class TreeTypeMap( import tpd._ /** If `sym` is one of `oldOwners`, replace by corresponding symbol in `newOwners` */ - def mapOwner(sym: Symbol) = sym.subst(oldOwners, newOwners) + def mapOwner(sym: Symbol): Symbol = sym.subst(oldOwners, newOwners) /** Replace occurrences of `This(oldOwner)` in some prefix of a type * by the corresponding `This(newOwner)`. @@ -59,7 +59,7 @@ class TreeTypeMap( } } - def mapType(tp: Type) = + def mapType(tp: Type): Type = mapOwnerThis(typeMap(tp).substSym(substFrom, substTo)) private def updateDecls(prevStats: List[Tree], newStats: List[Tree]): Unit = @@ -128,7 +128,7 @@ class TreeTypeMap( } } - override def transformStats(trees: List[tpd.Tree])(implicit ctx: Context) = + override def transformStats(trees: List[tpd.Tree])(implicit ctx: Context): List[Tree] = transformDefs(trees)._2 def transformDefs[TT <: tpd.Tree](trees: List[TT])(implicit ctx: Context): (TreeTypeMap, List[TT]) = { diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 8869ebc12711..6c7216c2b3d6 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -8,6 +8,7 @@ import SymDenotations._, Symbols._, Denotations._, StdNames._, Comments._ import language.higherKinds import collection.mutable.ListBuffer import printing.Printer +import printing.Texts.Text import util.{Stats, Attachment, Property} import config.Config import annotation.internal.sharable @@ -24,10 +25,10 @@ object Trees { type Untyped = Null /** The total number of created tree nodes, maintained if Stats.enabled */ - @sharable var ntrees = 0 + @sharable var ntrees: Int = 0 /** Property key for trees with documentation strings attached */ - val DocComment = new Property.StickyKey[Comment] + val DocComment: Property.StickyKey[Comments.Comment] = new Property.StickyKey[Comment] @sharable private[this] var nextId = 0 // for debugging @@ -69,7 +70,7 @@ object Trees { */ @sharable private var myUniqueId: Int = nxId - def uniqueId = myUniqueId + def uniqueId: Int = myUniqueId /** The type constructor at the root of the tree */ type ThisTree[T >: Untyped] <: Tree[T] @@ -81,7 +82,7 @@ object Trees { * which implements copy-on-write. Another use-case is in method interpolateAndAdapt in Typer, * where we overwrite with a simplified version of the type itself. */ - private[dotc] def overwriteType(tpe: T) = + private[dotc] def overwriteType(tpe: T): Unit = myTpe = tpe /** The type of the tree. In case of an untyped tree, @@ -207,7 +208,7 @@ object Trees { */ def foreachInThicket(op: Tree[T] => Unit): Unit = op(this) - override def toText(printer: Printer) = printer.toText(this) + override def toText(printer: Printer): Text = printer.toText(this) def sameTree(that: Tree[_]): Boolean = { def isSame(x: Any, y: Any): Boolean = @@ -235,7 +236,7 @@ object Trees { } override def hashCode(): Int = uniqueId // for debugging; was: System.identityHashCode(this) - override def equals(that: Any) = this eq that.asInstanceOf[AnyRef] + override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef] override def clone: Tree[T] = { val tree = super.clone.asInstanceOf[Tree[T]] @@ -255,7 +256,7 @@ object Trees { */ trait TypTree[-T >: Untyped] extends Tree[T] { type ThisTree[-T >: Untyped] <: TypTree[T] - override def isType = true + override def isType: Boolean = true } /** Instances of this class are trees for which isTerm is definitely true. @@ -263,7 +264,7 @@ object Trees { */ trait TermTree[-T >: Untyped] extends Tree[T] { type ThisTree[-T >: Untyped] <: TermTree[T] - override def isTerm = true + override def isTerm: Boolean = true } /** Instances of this class are trees which are not terms but are legal @@ -271,13 +272,13 @@ object Trees { */ trait PatternTree[-T >: Untyped] extends Tree[T] { type ThisTree[-T >: Untyped] <: PatternTree[T] - override def isPattern = true + override def isPattern: Boolean = true } /** Tree's denotation can be derived from its type */ abstract class DenotingTree[-T >: Untyped] extends Tree[T] { type ThisTree[-T >: Untyped] <: DenotingTree[T] - override def denot(implicit ctx: Context) = typeOpt match { + override def denot(implicit ctx: Context): Denotation = typeOpt match { case tpe: NamedType => tpe.denot case tpe: ThisType => tpe.cls.denot case tpe: AnnotatedType => tpe.stripAnnots match { @@ -296,8 +297,8 @@ object Trees { type ThisTree[-T >: Untyped] <: ProxyTree[T] def forwardTo: Tree[T] override def denot(implicit ctx: Context): Denotation = forwardTo.denot - override def isTerm = forwardTo.isTerm - override def isType = forwardTo.isType + override def isTerm: Boolean = forwardTo.isTerm + override def isType: Boolean = forwardTo.isType } /** Tree has a name */ @@ -310,15 +311,15 @@ object Trees { abstract class RefTree[-T >: Untyped] extends NameTree[T] { type ThisTree[-T >: Untyped] <: RefTree[T] def qualifier: Tree[T] - override def isType = name.isTypeName - override def isTerm = name.isTermName + override def isType: Boolean = name.isTypeName + override def isTerm: Boolean = name.isTermName } /** Tree defines a new symbol */ trait DefTree[-T >: Untyped] extends DenotingTree[T] { type ThisTree[-T >: Untyped] <: DefTree[T] - override def isDef = true - def namedType = tpe.asInstanceOf[NamedType] + override def isDef: Boolean = true + def namedType: NamedType = tpe.asInstanceOf[NamedType] } /** Tree defines a new symbol and carries modifiers. @@ -349,7 +350,7 @@ object Trees { asInstanceOf[ThisTree[Untyped]] } - protected def setMods(mods: untpd.Modifiers) = myMods = mods + protected def setMods(mods: untpd.Modifiers): Unit = myMods = mods /** The position of the name defined by this definition. * This is a point position if the definition is synthetic, or a range position @@ -357,7 +358,7 @@ object Trees { * It might also be that the definition does not have a position (for instance when synthesized by * a calling chain from `viewExists`), in that case the return position is NoPosition. */ - def namePos = + def namePos: Position = if (pos.exists) { val point = pos.point if (rawMods.is(Synthetic) || name.toTermName == nme.ERROR) Position(point) @@ -390,12 +391,12 @@ object Trees { extends Ident[T](name) { override def isBackquoted: Boolean = true - override def toString = s"BackquotedIdent($name)" + override def toString: String = s"BackquotedIdent($name)" } class SearchFailureIdent[-T >: Untyped] private[ast] (name: Name) extends Ident[T](name) { - override def toString = s"SearchFailureIdent($name)" + override def toString: String = s"SearchFailureIdent($name)" } /** qualifier.name, or qualifier#name, if qualifier is a type */ @@ -406,7 +407,7 @@ object Trees { class SelectWithSig[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name, val sig: Signature) extends Select[T](qualifier, name) { - override def toString = s"SelectWithSig($qualifier, $name, $sig)" + override def toString: String = s"SelectWithSig($qualifier, $name, $sig)" } /** qual.this */ @@ -428,14 +429,14 @@ object Trees { case class Super[-T >: Untyped] private[ast] (qual: Tree[T], mix: untpd.Ident) extends ProxyTree[T] with TermTree[T] { type ThisTree[-T >: Untyped] = Super[T] - def forwardTo = qual + def forwardTo: Tree[T] = qual } abstract class GenericApply[-T >: Untyped] extends ProxyTree[T] with TermTree[T] { type ThisTree[-T >: Untyped] <: GenericApply[T] val fun: Tree[T] val args: List[Tree[T]] - def forwardTo = fun + def forwardTo: Tree[T] = fun } /** fun(args) */ @@ -466,7 +467,7 @@ object Trees { case class Typed[-T >: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T]) extends ProxyTree[T] with TermTree[T] { type ThisTree[-T >: Untyped] = Typed[T] - def forwardTo = expr + def forwardTo: Tree[T] = expr } /** name = arg, in a parameter list */ @@ -577,7 +578,7 @@ object Trees { /** Array(elems) */ class JavaSeqLiteral[T >: Untyped] private[ast] (elems: List[Tree[T]], elemtpt: Tree[T]) extends SeqLiteral(elems, elemtpt) { - override def toString = s"JavaSeqLiteral($elems, $elemtpt)" + override def toString: String = s"JavaSeqLiteral($elems, $elemtpt)" } /** A tree representing inlined code. @@ -599,15 +600,15 @@ object Trees { case class Inlined[-T >: Untyped] private[ast] (call: tpd.Tree, bindings: List[MemberDef[T]], expansion: Tree[T]) extends Tree[T] { type ThisTree[-T >: Untyped] = Inlined[T] - override def initialPos = call.pos + override def initialPos: Position = call.pos } /** A type tree that represents an existing or inferred type */ case class TypeTree[-T >: Untyped] () extends DenotingTree[T] with TypTree[T] { type ThisTree[-T >: Untyped] = TypeTree[T] - override def isEmpty = !hasType - override def toString = + override def isEmpty: Boolean = !hasType + override def toString: String = s"TypeTree${if (hasType) s"[$typeOpt]" else ""}" } @@ -638,14 +639,14 @@ object Trees { case class RefinedTypeTree[-T >: Untyped] private[ast] (tpt: Tree[T], refinements: List[Tree[T]]) extends ProxyTree[T] with TypTree[T] { type ThisTree[-T >: Untyped] = RefinedTypeTree[T] - def forwardTo = tpt + def forwardTo: Tree[T] = tpt } /** tpt[args] */ case class AppliedTypeTree[-T >: Untyped] private[ast] (tpt: Tree[T], args: List[Tree[T]]) extends ProxyTree[T] with TypTree[T] { type ThisTree[-T >: Untyped] = AppliedTypeTree[T] - def forwardTo = tpt + def forwardTo: Tree[T] = tpt } /** [typeparams] -> tpt */ @@ -676,8 +677,8 @@ object Trees { case class Bind[-T >: Untyped] private[ast] (name: Name, body: Tree[T]) extends NameTree[T] with DefTree[T] with PatternTree[T] { type ThisTree[-T >: Untyped] = Bind[T] - override def isType = name.isTypeName - override def isTerm = name.isTermName + override def isType: Boolean = name.isTypeName + override def isTerm: Boolean = name.isTermName } /** tree_1 | ... | tree_n */ @@ -710,8 +711,8 @@ object Trees { extends ValOrDefDef[T] { type ThisTree[-T >: Untyped] = ValDef[T] assert(isEmpty || tpt != genericEmptyTree) - def unforced = preRhs - protected def force(x: AnyRef) = preRhs = x + def unforced: LazyTree = preRhs + protected def force(x: AnyRef): Unit = preRhs = x } /** mods def name[tparams](vparams_1)...(vparams_n): tpt = rhs */ @@ -720,8 +721,8 @@ object Trees { extends ValOrDefDef[T] { type ThisTree[-T >: Untyped] = DefDef[T] assert(tpt != genericEmptyTree) - def unforced = preRhs - protected def force(x: AnyRef) = preRhs = x + def unforced: LazyTree = preRhs + protected def force(x: AnyRef): Unit = preRhs = x } /** mods class name template or @@ -734,16 +735,16 @@ object Trees { type ThisTree[-T >: Untyped] = TypeDef[T] /** Is this a definition of a class? */ - def isClassDef = rhs.isInstanceOf[Template[_]] + def isClassDef: Boolean = rhs.isInstanceOf[Template[_]] } /** extends parents { self => body } */ case class Template[-T >: Untyped] private[ast] (constr: DefDef[T], parents: List[Tree[T]], self: ValDef[T], private var preBody: LazyTreeList) extends DefTree[T] with WithLazyField[List[Tree[T]]] { type ThisTree[-T >: Untyped] = Template[T] - def unforcedBody = unforced - def unforced = preBody - protected def force(x: AnyRef) = preBody = x + def unforcedBody: LazyTreeList = unforced + def unforced: LazyTreeList = preBody + protected def force(x: AnyRef): Unit = preBody = x def body(implicit ctx: Context): List[Tree[T]] = forceIfLazy } @@ -760,20 +761,20 @@ object Trees { case class PackageDef[-T >: Untyped] private[ast] (pid: RefTree[T], stats: List[Tree[T]]) extends ProxyTree[T] { type ThisTree[-T >: Untyped] = PackageDef[T] - def forwardTo = pid + def forwardTo: RefTree[T] = pid } /** arg @annot */ case class Annotated[-T >: Untyped] private[ast] (arg: Tree[T], annot: Tree[T]) extends ProxyTree[T] { type ThisTree[-T >: Untyped] = Annotated[T] - def forwardTo = arg + def forwardTo: Tree[T] = arg } trait WithoutTypeOrPos[-T >: Untyped] extends Tree[T] { - override def withTypeUnchecked(tpe: Type) = this.asInstanceOf[ThisTree[Type]] - override def pos = NoPosition - override def setPos(pos: Position) = {} + override def withTypeUnchecked(tpe: Type): ThisTree[Type] = this.asInstanceOf[ThisTree[Type]] + override def pos: Position = NoPosition + override def setPos(pos: Position): Unit = {} } /** Temporary class that results from translation of ModuleDefs @@ -788,7 +789,7 @@ object Trees { type ThisTree[-T >: Untyped] = Thicket[T] override def isEmpty: Boolean = trees.isEmpty override def toList: List[Tree[T]] = flatten(trees) - override def toString = if (isEmpty) "EmptyTree" else "Thicket(" + trees.mkString(", ") + ")" + override def toString: String = if (isEmpty) "EmptyTree" else "Thicket(" + trees.mkString(", ") + ")" override def withPos(pos: Position): this.type = { val newTrees = trees.mapConserve(_.withPos(pos)) if (trees eq newTrees) @@ -796,7 +797,7 @@ object Trees { else new Thicket[T](newTrees).asInstanceOf[this.type] } - override def pos = (NoPosition /: trees) ((pos, t) => pos union t.pos) + override def pos: Position = (NoPosition /: trees) ((pos, t) => pos union t.pos) override def foreachInThicket(op: Tree[T] => Unit): Unit = trees foreach (_.foreachInThicket(op)) } @@ -809,7 +810,7 @@ object Trees { } @sharable val theEmptyTree: Thicket[Type] = Thicket(Nil) - @sharable val theEmptyValDef = new EmptyValDef[Type] + @sharable val theEmptyValDef: EmptyValDef[Type] = new EmptyValDef[Type] def genericEmptyValDef[T >: Untyped]: ValDef[T] = theEmptyValDef.asInstanceOf[ValDef[T]] def genericEmptyTree[T >: Untyped]: Thicket[T] = theEmptyTree.asInstanceOf[Thicket[T]] @@ -980,7 +981,7 @@ object Trees { case _ => finalize(tree, untpd.Select(qualifier, name)) } /** Copy Ident or Select trees */ - def Ref(tree: RefTree)(name: Name)(implicit ctx: Context) = tree match { + def Ref(tree: RefTree)(name: Name)(implicit ctx: Context): RefTree = tree match { case Ident(_) => Ident(tree)(name) case Select(qual, _) => Select(tree)(qual, name) } @@ -1423,8 +1424,8 @@ object Trees { abstract class TreeTraverser extends TreeAccumulator[Unit] { def traverse(tree: Tree)(implicit ctx: Context): Unit - def apply(x: Unit, tree: Tree)(implicit ctx: Context) = traverse(tree) - protected def traverseChildren(tree: Tree)(implicit ctx: Context) = foldOver((), tree) + def apply(x: Unit, tree: Tree)(implicit ctx: Context): Unit = traverse(tree) + protected def traverseChildren(tree: Tree)(implicit ctx: Context): Unit = foldOver((), tree) } /** Fold `f` over all tree nodes, in depth-first, prefix order */ diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 8c8ed29ca71c..c7007294b7c8 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -334,7 +334,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { // ------ Making references ------------------------------------------------------ - def prefixIsElidable(tp: NamedType)(implicit ctx: Context) = { + def prefixIsElidable(tp: NamedType)(implicit ctx: Context): Boolean = { val typeIsElidable = tp.prefix match { case pre: ThisType => tp.isType || @@ -353,7 +353,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { tp.symbol.hasAnnotation(defn.ScalaStaticAnnot) } - def needsSelect(tp: Type)(implicit ctx: Context) = tp match { + def needsSelect(tp: Type)(implicit ctx: Context): Boolean = tp match { case tp: TermRef => !prefixIsElidable(tp) case _ => false } @@ -477,9 +477,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { } /** A `_' with given type */ - def Underscore(tp: Type)(implicit ctx: Context) = untpd.Ident(nme.WILDCARD).withType(tp) + def Underscore(tp: Type)(implicit ctx: Context): Ident = untpd.Ident(nme.WILDCARD).withType(tp) - def defaultValue(tpe: Types.Type)(implicit ctx: Context) = { + def defaultValue(tpe: Type)(implicit ctx: Context): Tree = { val tpw = tpe.widen if (tpw isRef defn.IntClass) Literal(Constant(0)) @@ -507,7 +507,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { override val cpy: TypedTreeCopier = // Type ascription needed to pick up any new members in TreeCopier (currently there are none) new TypedTreeCopier - val cpyBetweenPhases = new TimeTravellingTreeCopier + val cpyBetweenPhases: TimeTravellingTreeCopier = new TimeTravellingTreeCopier class TypedTreeCopier extends TreeCopier { def postProcess(tree: Tree, copied: untpd.Tree): copied.ThisTree[Type] = @@ -677,14 +677,14 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { Closure(tree: Tree)(env, meth, tpt) } - override def skipTransform(tree: Tree)(implicit ctx: Context) = tree.tpe.isError + override def skipTransform(tree: Tree)(implicit ctx: Context): Boolean = tree.tpe.isError implicit class TreeOps[ThisTree <: tpd.Tree](private val tree: ThisTree) extends AnyVal { def isValue(implicit ctx: Context): Boolean = tree.isTerm && tree.tpe.widen.isValueType - def isValueOrPattern(implicit ctx: Context) = + def isValueOrPattern(implicit ctx: Context): Boolean = tree.isValue || tree.isPattern def isValueType: Boolean = @@ -695,10 +695,10 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { case _ => false } - def shallowFold[T](z: T)(op: (T, tpd.Tree) => T)(implicit ctx: Context) = + def shallowFold[T](z: T)(op: (T, tpd.Tree) => T)(implicit ctx: Context): T = new ShallowFolder(op).apply(z, tree) - def deepFold[T](z: T)(op: (T, tpd.Tree) => T)(implicit ctx: Context) = + def deepFold[T](z: T)(op: (T, tpd.Tree) => T)(implicit ctx: Context): T = new DeepFolder(op).apply(z, tree) def find[T](pred: (tpd.Tree) => Boolean)(implicit ctx: Context): Option[tpd.Tree] = @@ -826,7 +826,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { if (tree.tpe.widen.isParameterless) tree else tree.appliedToNone /** `tree == that` */ - def equal(that: Tree)(implicit ctx: Context) = + def equal(that: Tree)(implicit ctx: Context): Tree = if (that.tpe.widen.isRef(defn.NothingClass)) Literal(Constant(false)) else @@ -866,7 +866,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { /** If inititializer tree is `_', the default value of its type, * otherwise the tree itself. */ - def wildcardToDefault(implicit ctx: Context) = + def wildcardToDefault(implicit ctx: Context): Tree = if (isWildcardArg(tree)) defaultValue(tree.tpe) else tree /** `this && that`, for boolean trees `this`, `that` */ @@ -977,7 +977,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { rootTrees.headOption.getOrElse(EmptyTree) /** Is it possible that the tree to load contains a definition of or reference to `id`? */ - def mightContain(id: String)(implicit ctx: Context) = true + def mightContain(id: String)(implicit ctx: Context): Boolean = true } // convert a numeric with a toXXX method @@ -1061,7 +1061,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { * * ~within('tree) */ - def letBindUnless(level: TreeInfo.PurityLevel, tree: Tree)(within: Tree => Tree)(implicit ctx: Context) = { + def letBindUnless(level: TreeInfo.PurityLevel, tree: Tree)(within: Tree => Tree)(implicit ctx: Context): Tree = { if (exprPurity(tree) >= level) within(tree) else { val vdef = SyntheticValDef(TempResultName.fresh(), tree) @@ -1070,7 +1070,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { } /** Let bind `tree` unless `tree` is at least idempotent */ - def evalOnce(tree: Tree)(within: Tree => Tree)(implicit ctx: Context) = + def evalOnce(tree: Tree)(within: Tree => Tree)(implicit ctx: Context): Tree = letBindUnless(TreeInfo.Idempotent, tree)(within) def runtimeCall(name: TermName, args: List[Tree])(implicit ctx: Context): Tree = { @@ -1112,7 +1112,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { /** The source file where the symbol of the `inline` method referred to by `call` * is defined */ - def sourceFile(call: Tree)(implicit ctx: Context) = { + def sourceFile(call: Tree)(implicit ctx: Context): SourceFile = { val file = call.symbol.sourceFile val encoding = ctx.settings.encoding.value if (file != null && file.exists) new SourceFile(file, Codec(encoding)) else NoSource diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala index bc63791189ce..c9337c69acfe 100644 --- a/compiler/src/dotty/tools/dotc/ast/untpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala @@ -16,15 +16,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { trait OpTree extends Tree { def op: Ident - override def isTerm = op.name.isTermName - override def isType = op.name.isTypeName + override def isTerm: Boolean = op.name.isTermName + override def isType: Boolean = op.name.isTypeName } /** A typed subtree of an untyped tree needs to be wrapped in a TypedSplice * @param owner The current owner at the time the tree was defined */ abstract case class TypedSplice(splice: tpd.Tree)(val owner: Symbol) extends ProxyTree { - def forwardTo = splice + def forwardTo: tpd.Tree = splice } object TypedSplice { @@ -36,7 +36,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { case class ModuleDef(name: TermName, impl: Template) extends MemberDef { type ThisTree[-T >: Untyped] <: Trees.NameTree[T] with Trees.MemberDef[T] with ModuleDef - def withName(name: Name)(implicit ctx: Context) = cpy.ModuleDef(this)(name.toTermName, impl) + def withName(name: Name)(implicit ctx: Context): untpd.ModuleDef = cpy.ModuleDef(this)(name.toTermName, impl) } case class ParsedTry(expr: Tree, handler: Tree, finalizer: Tree) extends TermTree @@ -51,8 +51,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { /** A function type */ case class Function(args: List[Tree], body: Tree) extends Tree { - override def isTerm = body.isTerm - override def isType = body.isType + override def isTerm: Boolean = body.isTerm + override def isType: Boolean = body.isType } /** A function type with `implicit` or `erased` modifiers */ @@ -70,15 +70,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { case class InfixOp(left: Tree, op: Ident, right: Tree) extends OpTree case class PostfixOp(od: Tree, op: Ident) extends OpTree case class PrefixOp(op: Ident, od: Tree) extends OpTree { - override def isType = op.isType - override def isTerm = op.isTerm + override def isType: Boolean = op.isType + override def isTerm: Boolean = op.isTerm } case class Parens(t: Tree) extends ProxyTree { - def forwardTo = t + def forwardTo: Tree = t } case class Tuple(trees: List[Tree]) extends Tree { - override def isTerm = trees.isEmpty || trees.head.isTerm - override def isType = !isTerm + override def isTerm: Boolean = trees.isEmpty || trees.head.isTerm + override def isType: Boolean = !isTerm } case class Throw(expr: Tree) extends TermTree case class Quote(expr: Tree) extends TermTree @@ -92,7 +92,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { case class DependentTypeTree(tp: List[Symbol] => Type) extends Tree @sharable object EmptyTypeIdent extends Ident(tpnme.EMPTY) with WithoutTypeOrPos[Untyped] { - override def isEmpty = true + override def isEmpty: Boolean = true } /** A block generated by the XML parser, only treated specially by @@ -157,7 +157,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def toTypeFlags: Modifiers = withFlags(flags.toTypeFlags) def toTermFlags: Modifiers = withFlags(flags.toTermFlags) - def withFlags(flags: FlagSet) = + def withFlags(flags: FlagSet): untpd.Modifiers = if (this.flags == flags) this else copy(flags = flags) @@ -188,18 +188,18 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { if (annots eq annotations) this else copy(annotations = annots) - def withPrivateWithin(pw: TypeName) = + def withPrivateWithin(pw: TypeName): untpd.Modifiers = if (pw.isEmpty) this else copy(privateWithin = pw) - def hasFlags = flags != EmptyFlags - def hasAnnotations = annotations.nonEmpty - def hasPrivateWithin = privateWithin != tpnme.EMPTY + def hasFlags: Boolean = flags != EmptyFlags + def hasAnnotations: Boolean = annotations.nonEmpty + def hasPrivateWithin: Boolean = privateWithin != tpnme.EMPTY private def isEnum = is(Enum, butNot = JavaDefined) - def isEnumCase = isEnum && is(Case) - def isEnumClass = isEnum && !is(Case) + def isEnumCase: Boolean = isEnum && is(Case) + def isEnumClass: Boolean = isEnum && !is(Case) } @sharable val EmptyModifiers: Modifiers = new Modifiers() @@ -243,13 +243,13 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { * from the symbol in this type. These type trees have marker trees * TypeRefOfSym or InfoOfSym as their originals. */ - val References = new Property.Key[List[DerivedTypeTree]] + val References: Property.Key[List[DerivedTypeTree]] = new Property.Key[List[DerivedTypeTree]] /** Property key for TypeTrees marked with TypeRefOfSym or InfoOfSym * which contains the symbol of the original tree from which this * TypeTree is derived. */ - val OriginalSymbol = new Property.Key[Symbol] + val OriginalSymbol: Property.Key[Symbol] = new Property.Key[Symbol] // ------ Creation methods for untyped only ----------------- @@ -279,7 +279,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def SeqLiteral(elems: List[Tree], elemtpt: Tree): SeqLiteral = new SeqLiteral(elems, elemtpt) def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree): JavaSeqLiteral = new JavaSeqLiteral(elems, elemtpt) def Inlined(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree): Inlined = new Inlined(call, bindings, expansion) - def TypeTree() = new TypeTree() + def TypeTree(): TypeTree = new TypeTree() def SingletonTypeTree(ref: Tree): SingletonTypeTree = new SingletonTypeTree(ref) def AndTypeTree(left: Tree, right: Tree): AndTypeTree = new AndTypeTree(left, right) def OrTypeTree(left: Tree, right: Tree): OrTypeTree = new OrTypeTree(left, right) @@ -333,7 +333,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def Apply(fn: Tree, arg: Tree): Apply = Apply(fn, arg :: Nil) - def ensureApplied(tpt: Tree) = tpt match { + def ensureApplied(tpt: Tree): Tree = tpt match { case _: Apply => tpt case _ => Apply(tpt, Nil) } @@ -343,15 +343,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def TypeTree(tpe: Type)(implicit ctx: Context): TypedSplice = TypedSplice(TypeTree().withTypeUnchecked(tpe)) - def unitLiteral = Literal(Constant(())) + def unitLiteral: Literal = Literal(Constant(())) def ref(tp: NamedType)(implicit ctx: Context): Tree = TypedSplice(tpd.ref(tp)) - def rootDot(name: Name) = Select(Ident(nme.ROOTPKG), name) - def scalaDot(name: Name) = Select(rootDot(nme.scala_), name) - def scalaUnit = scalaDot(tpnme.Unit) - def scalaAny = scalaDot(tpnme.Any) + def rootDot(name: Name): Select = Select(Ident(nme.ROOTPKG), name) + def scalaDot(name: Name): Select = Select(rootDot(nme.scala_), name) + def scalaUnit: Select = scalaDot(tpnme.Unit) + def scalaAny: Select = scalaDot(tpnme.Any) def makeConstructor(tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(implicit ctx: Context): DefDef = DefDef(nme.CONSTRUCTOR, tparams, vparamss, TypeTree(), rhs) @@ -359,15 +359,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def emptyConstructor(implicit ctx: Context): DefDef = makeConstructor(Nil, Nil) - def makeSelfDef(name: TermName, tpt: Tree)(implicit ctx: Context) = + def makeSelfDef(name: TermName, tpt: Tree)(implicit ctx: Context): ValDef = ValDef(name, tpt, EmptyTree).withFlags(PrivateLocal) - def makeTupleOrParens(ts: List[Tree])(implicit ctx: Context) = ts match { + def makeTupleOrParens(ts: List[Tree])(implicit ctx: Context): Tree = ts match { case t :: Nil => Parens(t) case _ => Tuple(ts) } - def makeTuple(ts: List[Tree])(implicit ctx: Context) = ts match { + def makeTuple(ts: List[Tree])(implicit ctx: Context): Tree = ts match { case t :: Nil => t case _ => Tuple(ts) } @@ -378,26 +378,26 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { def makeSyntheticParameter(n: Int = 1, tpt: Tree = TypeTree())(implicit ctx: Context): ValDef = ValDef(nme.syntheticParamName(n), tpt, EmptyTree).withFlags(SyntheticTermParam) - def lambdaAbstract(tparams: List[TypeDef], tpt: Tree)(implicit ctx: Context) = + def lambdaAbstract(tparams: List[TypeDef], tpt: Tree)(implicit ctx: Context): Tree = if (tparams.isEmpty) tpt else LambdaTypeTree(tparams, tpt) /** A reference to given definition. If definition is a repeated * parameter, the reference will be a repeated argument. */ - def refOfDef(tree: MemberDef)(implicit ctx: Context) = tree match { + def refOfDef(tree: MemberDef)(implicit ctx: Context): Tree = tree match { case ValDef(_, PostfixOp(_, Ident(tpnme.raw.STAR)), _) => repeated(Ident(tree.name)) case _ => Ident(tree.name) } /** A repeated argument such as `arg: _*` */ - def repeated(arg: Tree)(implicit ctx: Context) = Typed(arg, Ident(tpnme.WILDCARD_STAR)) + def repeated(arg: Tree)(implicit ctx: Context): Typed = Typed(arg, Ident(tpnme.WILDCARD_STAR)) // ----- Accessing modifiers ---------------------------------------------------- abstract class ModsDecorator { def mods: Modifiers } implicit class modsDeco(val mdef: MemberDef)(implicit ctx: Context) { - def mods = mdef.rawMods + def mods: untpd.Modifiers = mdef.rawMods } // --------- Copier/Transformer/Accumulator classes for untyped trees ----- @@ -416,84 +416,84 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { } }.asInstanceOf[copied.ThisTree[Untyped]] - def ModuleDef(tree: Tree)(name: TermName, impl: Template) = tree match { + def ModuleDef(tree: Tree)(name: TermName, impl: Template): untpd.ModuleDef = tree match { case tree: ModuleDef if (name eq tree.name) && (impl eq tree.impl) => tree case _ => finalize(tree, untpd.ModuleDef(name, impl)) } - def ParsedTry(tree: Tree)(expr: Tree, handler: Tree, finalizer: Tree) = tree match { + def ParsedTry(tree: Tree)(expr: Tree, handler: Tree, finalizer: Tree): TermTree = tree match { case tree: ParsedTry if (expr eq tree.expr) && (handler eq tree.handler) && (finalizer eq tree.finalizer) => tree case _ => finalize(tree, untpd.ParsedTry(expr, handler, finalizer)) } - def SymbolLit(tree: Tree)(str: String) = tree match { + def SymbolLit(tree: Tree)(str: String): TermTree = tree match { case tree: SymbolLit if str == tree.str => tree case _ => finalize(tree, untpd.SymbolLit(str)) } - def InterpolatedString(tree: Tree)(id: TermName, segments: List[Tree]) = tree match { + def InterpolatedString(tree: Tree)(id: TermName, segments: List[Tree]): TermTree = tree match { case tree: InterpolatedString if (id eq tree.id) && (segments eq tree.segments) => tree case _ => finalize(tree, untpd.InterpolatedString(id, segments)) } - def Function(tree: Tree)(args: List[Tree], body: Tree) = tree match { + def Function(tree: Tree)(args: List[Tree], body: Tree): Tree = tree match { case tree: Function if (args eq tree.args) && (body eq tree.body) => tree case _ => finalize(tree, untpd.Function(args, body)) } - def InfixOp(tree: Tree)(left: Tree, op: Ident, right: Tree) = tree match { + def InfixOp(tree: Tree)(left: Tree, op: Ident, right: Tree): Tree = tree match { case tree: InfixOp if (left eq tree.left) && (op eq tree.op) && (right eq tree.right) => tree case _ => finalize(tree, untpd.InfixOp(left, op, right)) } - def PostfixOp(tree: Tree)(od: Tree, op: Ident) = tree match { + def PostfixOp(tree: Tree)(od: Tree, op: Ident): Tree = tree match { case tree: PostfixOp if (od eq tree.od) && (op eq tree.op) => tree case _ => finalize(tree, untpd.PostfixOp(od, op)) } - def PrefixOp(tree: Tree)(op: Ident, od: Tree) = tree match { + def PrefixOp(tree: Tree)(op: Ident, od: Tree): Tree = tree match { case tree: PrefixOp if (op eq tree.op) && (od eq tree.od) => tree case _ => finalize(tree, untpd.PrefixOp(op, od)) } - def Parens(tree: Tree)(t: Tree) = tree match { + def Parens(tree: Tree)(t: Tree): ProxyTree = tree match { case tree: Parens if t eq tree.t => tree case _ => finalize(tree, untpd.Parens(t)) } - def Tuple(tree: Tree)(trees: List[Tree]) = tree match { + def Tuple(tree: Tree)(trees: List[Tree]): Tree = tree match { case tree: Tuple if trees eq tree.trees => tree case _ => finalize(tree, untpd.Tuple(trees)) } - def Throw(tree: Tree)(expr: Tree) = tree match { + def Throw(tree: Tree)(expr: Tree): TermTree = tree match { case tree: Throw if expr eq tree.expr => tree case _ => finalize(tree, untpd.Throw(expr)) } - def Quote(tree: Tree)(expr: Tree) = tree match { + def Quote(tree: Tree)(expr: Tree): TermTree = tree match { case tree: Quote if expr eq tree.expr => tree case _ => finalize(tree, untpd.Quote(expr)) } - def DoWhile(tree: Tree)(body: Tree, cond: Tree) = tree match { + def DoWhile(tree: Tree)(body: Tree, cond: Tree): TermTree = tree match { case tree: DoWhile if (body eq tree.body) && (cond eq tree.cond) => tree case _ => finalize(tree, untpd.DoWhile(body, cond)) } - def ForYield(tree: Tree)(enums: List[Tree], expr: Tree) = tree match { + def ForYield(tree: Tree)(enums: List[Tree], expr: Tree): TermTree = tree match { case tree: ForYield if (enums eq tree.enums) && (expr eq tree.expr) => tree case _ => finalize(tree, untpd.ForYield(enums, expr)) } - def ForDo(tree: Tree)(enums: List[Tree], body: Tree) = tree match { + def ForDo(tree: Tree)(enums: List[Tree], body: Tree): TermTree = tree match { case tree: ForDo if (enums eq tree.enums) && (body eq tree.body) => tree case _ => finalize(tree, untpd.ForDo(enums, body)) } - def GenFrom(tree: Tree)(pat: Tree, expr: Tree) = tree match { + def GenFrom(tree: Tree)(pat: Tree, expr: Tree): Tree = tree match { case tree: GenFrom if (pat eq tree.pat) && (expr eq tree.expr) => tree case _ => finalize(tree, untpd.GenFrom(pat, expr)) } - def GenAlias(tree: Tree)(pat: Tree, expr: Tree) = tree match { + def GenAlias(tree: Tree)(pat: Tree, expr: Tree): Tree = tree match { case tree: GenAlias if (pat eq tree.pat) && (expr eq tree.expr) => tree case _ => finalize(tree, untpd.GenAlias(pat, expr)) } - def ContextBounds(tree: Tree)(bounds: TypeBoundsTree, cxBounds: List[Tree]) = tree match { + def ContextBounds(tree: Tree)(bounds: TypeBoundsTree, cxBounds: List[Tree]): TypTree = tree match { case tree: ContextBounds if (bounds eq tree.bounds) && (cxBounds eq tree.cxBounds) => tree case _ => finalize(tree, untpd.ContextBounds(bounds, cxBounds)) } - def PatDef(tree: Tree)(mods: Modifiers, pats: List[Tree], tpt: Tree, rhs: Tree) = tree match { + def PatDef(tree: Tree)(mods: Modifiers, pats: List[Tree], tpt: Tree, rhs: Tree): Tree = tree match { case tree: PatDef if (mods eq tree.mods) && (pats eq tree.pats) && (tpt eq tree.tpt) && (rhs eq tree.rhs) => tree case _ => finalize(tree, untpd.PatDef(mods, pats, tpt, rhs)) } - def TypedSplice(tree: Tree)(splice: tpd.Tree)(implicit ctx: Context) = tree match { + def TypedSplice(tree: Tree)(splice: tpd.Tree)(implicit ctx: Context): ProxyTree = tree match { case tree: TypedSplice if splice `eq` tree.splice => tree case _ => finalize(tree, untpd.TypedSplice(splice)) } @@ -595,8 +595,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { abstract class UntypedTreeTraverser extends UntypedTreeAccumulator[Unit] { def traverse(tree: Tree)(implicit ctx: Context): Unit - def apply(x: Unit, tree: Tree)(implicit ctx: Context) = traverse(tree) - protected def traverseChildren(tree: Tree)(implicit ctx: Context) = foldOver((), tree) + def apply(x: Unit, tree: Tree)(implicit ctx: Context): Unit = traverse(tree) + protected def traverseChildren(tree: Tree)(implicit ctx: Context): Unit = foldOver((), tree) } /** Fold `f` over all tree nodes, in depth-first, prefix order */ diff --git a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala index d0d499b28e65..24cd2e4d632b 100644 --- a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala @@ -65,7 +65,7 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath { override private[dotty] def sources(inPackage: String): Seq[SourceFileEntry] = getDistinctEntries(_.sources(inPackage)) - override private[dotty] def hasPackage(pkg: String) = aggregates.exists(_.hasPackage(pkg)) + override private[dotty] def hasPackage(pkg: String): Boolean = aggregates.exists(_.hasPackage(pkg)) override private[dotty] def list(inPackage: String): ClassPathEntries = { val (packages, classesAndSources) = aggregates.map { cp => try { diff --git a/compiler/src/dotty/tools/dotc/classpath/ClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/ClassPath.scala index 06a465530db3..6895897989d0 100644 --- a/compiler/src/dotty/tools/dotc/classpath/ClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/ClassPath.scala @@ -7,7 +7,7 @@ import dotty.tools.io.AbstractFile import dotty.tools.io.ClassRepresentation case class ClassPathEntries(packages: Seq[PackageEntry], classesAndSources: Seq[ClassRepresentation]) { - def toTuple = (packages, classesAndSources) + def toTuple: (Seq[PackageEntry], Seq[ClassRepresentation]) = (packages, classesAndSources) } trait ClassFileEntry extends ClassRepresentation { @@ -23,21 +23,21 @@ trait PackageEntry { } private[dotty] case class ClassFileEntryImpl(file: AbstractFile) extends ClassFileEntry { - override def name = FileUtils.stripClassExtension(file.name) // class name + override def name: String = FileUtils.stripClassExtension(file.name) // class name override def binary: Option[AbstractFile] = Some(file) override def source: Option[AbstractFile] = None } private[dotty] case class SourceFileEntryImpl(file: AbstractFile) extends SourceFileEntry { - override def name = FileUtils.stripSourceExtension(file.name) + override def name: String = FileUtils.stripSourceExtension(file.name) override def binary: Option[AbstractFile] = None override def source: Option[AbstractFile] = Some(file) } private[dotty] case class ClassAndSourceFilesEntry(classFile: AbstractFile, srcFile: AbstractFile) extends ClassRepresentation { - override def name = FileUtils.stripClassExtension(classFile.name) + override def name: String = FileUtils.stripClassExtension(classFile.name) override def binary: Option[AbstractFile] = Some(classFile) override def source: Option[AbstractFile] = Some(srcFile) diff --git a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala index 0bdd0c33c287..3ade2fcf2f13 100644 --- a/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala +++ b/compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala @@ -42,14 +42,14 @@ class ClassPathFactory { def classesInExpandedPath(path: String)(implicit ctx: Context): IndexedSeq[ClassPath] = classesInPathImpl(path, expand = true).toIndexedSeq - def classesInPath(path: String)(implicit ctx: Context) = classesInPathImpl(path, expand = false) + def classesInPath(path: String)(implicit ctx: Context): List[ClassPath] = classesInPathImpl(path, expand = false) - def classesInManifest(useManifestClassPath: Boolean)(implicit ctx: Context) = + def classesInManifest(useManifestClassPath: Boolean)(implicit ctx: Context): List[ClassPath] = if (useManifestClassPath) dotty.tools.io.ClassPath.manifests.map(url => newClassPath(AbstractFile getResources url)) else Nil // Internal - protected def classesInPathImpl(path: String, expand: Boolean)(implicit ctx: Context) = + protected def classesInPathImpl(path: String, expand: Boolean)(implicit ctx: Context): List[ClassPath] = for { file <- expandPath(path, expand) dir <- { diff --git a/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala index 9d36745e8536..a761d746efdd 100644 --- a/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala @@ -42,7 +42,7 @@ trait DirectoryLookup[FileEntryType <: ClassRepresentation] extends ClassPath { } } - override private[dotty] def hasPackage(pkg: String) = getDirectory(pkg).isDefined + override private[dotty] def hasPackage(pkg: String): Boolean = getDirectory(pkg).isDefined private[dotty] def packages(inPackage: String): Seq[PackageEntry] = { val dirForPackage = getDirectory(inPackage) @@ -161,7 +161,7 @@ final class JrtClassPath(fs: java.nio.file.FileSystem) extends ClassPath with No } /** Empty string represents root package */ - override private[dotty] def hasPackage(pkg: String) = packageToModuleBases.contains(pkg) + override private[dotty] def hasPackage(pkg: String): Boolean = packageToModuleBases.contains(pkg) override private[dotty] def packages(inPackage: String): Seq[PackageEntry] = { def matches(packageDottedName: String) = diff --git a/compiler/src/dotty/tools/dotc/classpath/FileUtils.scala b/compiler/src/dotty/tools/dotc/classpath/FileUtils.scala index ef571dbbf4b5..684fc7a58239 100644 --- a/compiler/src/dotty/tools/dotc/classpath/FileUtils.scala +++ b/compiler/src/dotty/tools/dotc/classpath/FileUtils.scala @@ -43,7 +43,7 @@ object FileUtils { else throw new FatalError("Unexpected source file ending: " + fileName) } - def dirPath(forPackage: String) = forPackage.replace('.', '/') + def dirPath(forPackage: String): String = forPackage.replace('.', '/') def endsClass(fileName: String): Boolean = fileName.length > 6 && fileName.substring(fileName.length - 6) == ".class" @@ -68,7 +68,7 @@ object FileUtils { def mayBeValidPackage(dirName: String): Boolean = (dirName != "META-INF") && (dirName != "") && (dirName.charAt(0) != '.') - def mkFileFilter(f: JFile => Boolean) = new FileFilter { + def mkFileFilter(f: JFile => Boolean): FileFilter = new FileFilter { def accept(pathname: JFile): Boolean = f(pathname) } } diff --git a/compiler/src/dotty/tools/dotc/classpath/ZipArchiveFileLookup.scala b/compiler/src/dotty/tools/dotc/classpath/ZipArchiveFileLookup.scala index 77f628c673d4..256956fdb54b 100644 --- a/compiler/src/dotty/tools/dotc/classpath/ZipArchiveFileLookup.scala +++ b/compiler/src/dotty/tools/dotc/classpath/ZipArchiveFileLookup.scala @@ -46,7 +46,7 @@ trait ZipArchiveFileLookup[FileEntryType <: ClassRepresentation] extends ClassPa if isRequiredFileType(entry) } yield createFileEntry(entry) - override private[dotty] def hasPackage(pkg: String) = findDirEntry(pkg).isDefined + override private[dotty] def hasPackage(pkg: String): Boolean = findDirEntry(pkg).isDefined override private[dotty] def list(inPackage: String): ClassPathEntries = { val foundDirEntry = findDirEntry(inPackage) diff --git a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala index 23a6b9babd5e..c99724b4d024 100644 --- a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala @@ -12,7 +12,7 @@ import scala.collection.JavaConverters._ object CompilerCommand { /** The name of the command */ - def cmdName = "dotc" + def cmdName: String = "dotc" private def explainAdvanced = """ |-- Notes on option parsing -- @@ -29,9 +29,9 @@ object CompilerCommand { | already are in phase X + 1. """ - def shortUsage = s"Usage: $cmdName " + def shortUsage: String = s"Usage: $cmdName " - def versionMsg = s"Dotty compiler $versionString -- $copyrightString" + def versionMsg: String = s"Dotty compiler $versionString -- $copyrightString" /** Distill arguments into summary detailing settings, errors and files to compiler */ def distill(args: Array[String])(implicit ctx: Context): ArgsSummary = { diff --git a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala index 97d9ec94890c..cbcf3c703f1d 100644 --- a/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala +++ b/compiler/src/dotty/tools/dotc/config/JavaPlatform.scala @@ -21,7 +21,7 @@ class JavaPlatform extends Platform { } // The given symbol is a method with the right name and signature to be a runnable java program. - def isMainMethod(sym: SymDenotation)(implicit ctx: Context) = + def isMainMethod(sym: SymDenotation)(implicit ctx: Context): Boolean = (sym.name == nme.main) && (sym.info match { case MethodTpe(_, defn.ArrayOf(el) :: Nil, restpe) => el =:= defn.StringType && (restpe isRef defn.UnitClass) case _ => false @@ -50,7 +50,7 @@ class JavaPlatform extends Platform { * to anything but other booleans, but it should be present in * case this is put to other uses. */ - def isMaybeBoxed(sym: ClassSymbol)(implicit ctx: Context) = { + def isMaybeBoxed(sym: ClassSymbol)(implicit ctx: Context): Boolean = { val d = defn import d._ (sym == ObjectClass) || diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index cc4fe9f6084f..feea5f68426e 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -10,6 +10,7 @@ import PartialFunction.condOpt import scala.language.postfixOps import core.Contexts._ import Settings._ +import dotty.tools.io.File // Loosely based on the draft specification at: // https://wiki.scala-lang.org/display/SW/Classpath @@ -20,14 +21,14 @@ object PathResolver { // security exceptions. import AccessControl._ - def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse "" + def firstNonEmpty(xs: String*): String = xs find (_ != "") getOrElse "" /** Map all classpath elements to absolute paths and reconstruct the classpath. */ - def makeAbsolute(cp: String) = ClassPath.map(cp, x => Path(x).toAbsolute.path) + def makeAbsolute(cp: String): String = ClassPath.map(cp, x => Path(x).toAbsolute.path) /** pretty print class path */ - def ppcp(s: String) = split(s) match { + def ppcp(s: String): String = split(s) match { case Nil => "" case Seq(x) => x case xs => xs map ("\n" + _) mkString @@ -43,20 +44,20 @@ object PathResolver { /** Environment variables which java pays attention to so it * seems we do as well. */ - def classPathEnv = envOrElse("CLASSPATH", "") - def sourcePathEnv = envOrElse("SOURCEPATH", "") + def classPathEnv: String = envOrElse("CLASSPATH", "") + def sourcePathEnv: String = envOrElse("SOURCEPATH", "") - def javaBootClassPath = propOrElse("sun.boot.class.path", searchForBootClasspath) + def javaBootClassPath: String = propOrElse("sun.boot.class.path", searchForBootClasspath) - def javaExtDirs = propOrEmpty("java.ext.dirs") - def scalaHome = propOrEmpty("scala.home") - def scalaExtDirs = propOrEmpty("scala.ext.dirs") + def javaExtDirs: String = propOrEmpty("java.ext.dirs") + def scalaHome: String = propOrEmpty("scala.home") + def scalaExtDirs: String = propOrEmpty("scala.ext.dirs") /** The java classpath and whether to use it. */ - def javaUserClassPath = propOrElse("java.class.path", "") - def useJavaClassPath = propOrFalse("scala.usejavacp") + def javaUserClassPath: String = propOrElse("java.class.path", "") + def useJavaClassPath: Boolean = propOrFalse("scala.usejavacp") - override def toString = s""" + override def toString: String = s""" |object Environment { | scalaHome = $scalaHome (useJavaClassPath = $useJavaClassPath) | javaBootClassPath = <${javaBootClassPath.length} chars> @@ -70,27 +71,27 @@ object PathResolver { * to the path resolution specification. */ object Defaults { - def scalaSourcePath = Environment.sourcePathEnv - def javaBootClassPath = Environment.javaBootClassPath - def javaUserClassPath = Environment.javaUserClassPath - def javaExtDirs = Environment.javaExtDirs - def useJavaClassPath = Environment.useJavaClassPath + def scalaSourcePath: String = Environment.sourcePathEnv + def javaBootClassPath: String = Environment.javaBootClassPath + def javaUserClassPath: String = Environment.javaUserClassPath + def javaExtDirs: String = Environment.javaExtDirs + def useJavaClassPath: Boolean = Environment.useJavaClassPath - def scalaHome = Environment.scalaHome - def scalaHomeDir = Directory(scalaHome) - def scalaHomeExists = scalaHomeDir.isDirectory - def scalaLibDir = (scalaHomeDir / "lib").toDirectory - def scalaClassesDir = (scalaHomeDir / "classes").toDirectory + def scalaHome: String = Environment.scalaHome + def scalaHomeDir: Directory = Directory(scalaHome) + def scalaHomeExists: Boolean = scalaHomeDir.isDirectory + def scalaLibDir: Directory = (scalaHomeDir / "lib").toDirectory + def scalaClassesDir: Directory = (scalaHomeDir / "classes").toDirectory - def scalaLibAsJar = (scalaLibDir / "scala-library.jar").toFile - def scalaLibAsDir = (scalaClassesDir / "library").toDirectory + def scalaLibAsJar: File = (scalaLibDir / "scala-library.jar").toFile + def scalaLibAsDir: Directory = (scalaClassesDir / "library").toDirectory def scalaLibDirFound: Option[Directory] = if (scalaLibAsJar.isFile) Some(scalaLibDir) else if (scalaLibAsDir.isDirectory) Some(scalaClassesDir) else None - def scalaLibFound = + def scalaLibFound: String = if (scalaLibAsJar.isFile) scalaLibAsJar.path else if (scalaLibAsDir.isDirectory) scalaLibAsDir.path else "" @@ -100,7 +101,7 @@ object PathResolver { // the scala jars to end up on the classpath twice: one on the boot // classpath as set up by the runner (or regular classpath under -nobootcp) // and then again here. - def scalaBootClassPath = "" + def scalaBootClassPath: String = "" // scalaLibDirFound match { // case Some(dir) if scalaHomeExists => // val paths = ClassPath expandDir dir.path @@ -108,11 +109,11 @@ object PathResolver { // case _ => "" // } - def scalaExtDirs = Environment.scalaExtDirs + def scalaExtDirs: String = Environment.scalaExtDirs - def scalaPluginPath = (scalaHomeDir / "misc" / "scala-devel" / "plugins").path + def scalaPluginPath: String = (scalaHomeDir / "misc" / "scala-devel" / "plugins").path - override def toString = """ + override def toString: String = """ |object Defaults { | scalaHome = %s | javaBootClassPath = %s @@ -186,14 +187,14 @@ class PathResolver(implicit ctx: Context) { * those in Defaults. */ object Calculated { - def scalaHome = Defaults.scalaHome - def useJavaClassPath = settings.usejavacp.value || Defaults.useJavaClassPath - def javaBootClassPath = cmdLineOrElse("javabootclasspath", Defaults.javaBootClassPath) - def javaExtDirs = cmdLineOrElse("javaextdirs", Defaults.javaExtDirs) - def javaUserClassPath = if (useJavaClassPath) Defaults.javaUserClassPath else "" - def scalaBootClassPath = cmdLineOrElse("bootclasspath", Defaults.scalaBootClassPath) - def scalaExtDirs = cmdLineOrElse("extdirs", Defaults.scalaExtDirs) - def priorityClassPath = cmdLineOrElse("priorityclasspath", "") + def scalaHome: String = Defaults.scalaHome + def useJavaClassPath: Boolean = settings.usejavacp.value || Defaults.useJavaClassPath + def javaBootClassPath: String = cmdLineOrElse("javabootclasspath", Defaults.javaBootClassPath) + def javaExtDirs: String = cmdLineOrElse("javaextdirs", Defaults.javaExtDirs) + def javaUserClassPath: String = if (useJavaClassPath) Defaults.javaUserClassPath else "" + def scalaBootClassPath: String = cmdLineOrElse("bootclasspath", Defaults.scalaBootClassPath) + def scalaExtDirs: String = cmdLineOrElse("extdirs", Defaults.scalaExtDirs) + def priorityClassPath: String = cmdLineOrElse("priorityclasspath", "") /** Scaladoc doesn't need any bootstrapping, otherwise will create errors such as: * [scaladoc] ../scala-trunk/src/reflect/scala/reflect/macros/Reifiers.scala:89: error: object api is not a member of package reflect * [scaladoc] case class ReificationException(val pos: reflect.api.PositionApi, val msg: String) extends Throwable(msg) @@ -202,7 +203,7 @@ class PathResolver(implicit ctx: Context) { * and then when typing relative names, instead of picking .scala.relect, typedIdentifier will pick up the * .reflect package created by the bootstrapping. Thus, no bootstrapping for scaladoc! * TODO: we should refactor this as a separate -bootstrap option to have a clean implementation, no? */ - def sourcePath = cmdLineOrElse("sourcepath", Defaults.scalaSourcePath) + def sourcePath: String = cmdLineOrElse("sourcepath", Defaults.scalaSourcePath) /** Against my better judgment, giving in to martin here and allowing * CLASSPATH to be used automatically. So for the user-specified part @@ -212,7 +213,7 @@ class PathResolver(implicit ctx: Context) { * - Otherwise, if CLASSPATH is set, it is that * - If neither of those, then "." is used. */ - def userClassPath = { + def userClassPath: String = { if (!settings.classpath.isDefault) settings.classpath.value else sys.env.getOrElse("CLASSPATH", ".") @@ -222,7 +223,7 @@ class PathResolver(implicit ctx: Context) { // Assemble the elements! // priority class path takes precedence - def basis = List[Traversable[ClassPath]]( + def basis: List[Traversable[ClassPath]] = List[Traversable[ClassPath]]( classesInExpandedPath(priorityClassPath), // 0. The priority class path (for testing). JrtClassPath.apply(), // 1. The Java 9 classpath (backed by the jrt:/ virtual system, if available) classesInPath(javaBootClassPath), // 2. The Java bootstrap class path. @@ -234,9 +235,9 @@ class PathResolver(implicit ctx: Context) { sourcesInPath(sourcePath) // 8. The Scala source path. ) - lazy val containers = basis.flatten.distinct + lazy val containers: List[ClassPath] = basis.flatten.distinct - override def toString = """ + override def toString: String = """ |object Calculated { | scalaHome = %s | priorityClassPath = %s @@ -257,7 +258,7 @@ class PathResolver(implicit ctx: Context) { ) } - def containers = Calculated.containers + def containers: List[ClassPath] = Calculated.containers lazy val result: ClassPath = { val cp = AggregateClassPath(containers.toIndexedSeq) @@ -274,6 +275,6 @@ class PathResolver(implicit ctx: Context) { cp } - def asURLs = result.asURLs + def asURLs: Seq[java.net.URL] = result.asURLs } diff --git a/compiler/src/dotty/tools/dotc/config/Properties.scala b/compiler/src/dotty/tools/dotc/config/Properties.scala index 06d29e16c0c1..d8e7a7060372 100644 --- a/compiler/src/dotty/tools/dotc/config/Properties.scala +++ b/compiler/src/dotty/tools/dotc/config/Properties.scala @@ -9,12 +9,12 @@ import java.util.jar.Attributes.{ Name => AttributeName } /** Loads `library.properties` from the jar. */ object Properties extends PropertiesTrait { - protected def propCategory = "compiler" - protected def pickJarBasedOn = classOf[Option[_]] + protected def propCategory: String = "compiler" + protected def pickJarBasedOn: Class[Option[_]] = classOf[Option[_]] /** Scala manifest attributes. */ - @sharable val ScalaCompilerVersion = new AttributeName("Scala-Compiler-Version") + @sharable val ScalaCompilerVersion: java.util.jar.Attributes.Name = new AttributeName("Scala-Compiler-Version") } trait PropertiesTrait { @@ -22,7 +22,7 @@ trait PropertiesTrait { protected def pickJarBasedOn: Class[_] // props file comes from jar containing this /** The name of the properties file */ - protected val propFilename = "/" + propCategory + ".properties" + protected val propFilename: String = "/" + propCategory + ".properties" /** The loaded properties */ @sharable protected lazy val scalaProps: java.util.Properties = { @@ -41,18 +41,18 @@ trait PropertiesTrait { catch { case _: IOException => } } - def propIsSet(name: String) = System.getProperty(name) != null - def propIsSetTo(name: String, value: String) = propOrNull(name) == value - def propOrElse(name: String, alt: String) = System.getProperty(name, alt) - def propOrEmpty(name: String) = propOrElse(name, "") - def propOrNull(name: String) = propOrElse(name, null) - def propOrNone(name: String) = Option(propOrNull(name)) - def propOrFalse(name: String) = propOrNone(name) exists (x => List("yes", "on", "true") contains x.toLowerCase) - def setProp(name: String, value: String) = System.setProperty(name, value) - def clearProp(name: String) = System.clearProperty(name) + def propIsSet(name: String): Boolean = System.getProperty(name) != null + def propIsSetTo(name: String, value: String): Boolean = propOrNull(name) == value + def propOrElse(name: String, alt: String): String = System.getProperty(name, alt) + def propOrEmpty(name: String): String = propOrElse(name, "") + def propOrNull(name: String): String = propOrElse(name, null) + def propOrNone(name: String): Option[String] = Option(propOrNull(name)) + def propOrFalse(name: String): Boolean = propOrNone(name) exists (x => List("yes", "on", "true") contains x.toLowerCase) + def setProp(name: String, value: String): String = System.setProperty(name, value) + def clearProp(name: String): String = System.clearProperty(name) - def envOrElse(name: String, alt: String) = Option(System getenv name) getOrElse alt - def envOrNone(name: String) = Option(System getenv name) + def envOrElse(name: String, alt: String): String = Option(System getenv name) getOrElse alt + def envOrNone(name: String): Option[String] = Option(System getenv name) // for values based on propFilename def scalaPropOrElse(name: String, alt: String): String = scalaProps.getProperty(name, alt) @@ -62,12 +62,12 @@ trait PropertiesTrait { /** Either the development or release version if known, otherwise * the empty string. */ - def versionNumberString = scalaPropOrEmpty("version.number") + def versionNumberString: String = scalaPropOrEmpty("version.number") /** The version number of the jar this was loaded from plus "version " prefix, * or "version (unknown)" if it cannot be determined. */ - val versionString = { + val versionString: String = { val v = scalaPropOrElse("version.number", "(unknown)") "version " + scalaPropOrElse("version.number", "(unknown)") + { if (v.contains("SNAPSHOT") || v.contains("NIGHTLY")) { @@ -82,53 +82,53 @@ trait PropertiesTrait { * 2. Features supported by experimental versions of the compiler: * - research plugins */ - val experimental = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") + val experimental: Boolean = versionString.contains("SNAPSHOT") || versionString.contains("NIGHTLY") - val copyrightString = scalaPropOrElse("copyright.string", "(c) 2002-2017 LAMP/EPFL") + val copyrightString: String = scalaPropOrElse("copyright.string", "(c) 2002-2017 LAMP/EPFL") /** This is the encoding to use reading in source files, overridden with -encoding * Note that it uses "prop" i.e. looks in the scala jar, not the system properties. */ - def sourceEncoding = scalaPropOrElse("file.encoding", "UTF-8") - def sourceReader = scalaPropOrElse("source.reader", "scala.tools.nsc.io.SourceReader") + def sourceEncoding: String = scalaPropOrElse("file.encoding", "UTF-8") + def sourceReader: String = scalaPropOrElse("source.reader", "scala.tools.nsc.io.SourceReader") /** This is the default text encoding, overridden (unreliably) with * `JAVA_OPTS="-Dfile.encoding=Foo"` */ - def encodingString = propOrElse("file.encoding", "UTF-8") + def encodingString: String = propOrElse("file.encoding", "UTF-8") /** The default end of line character. */ - def lineSeparator = propOrElse("line.separator", "\n") + def lineSeparator: String = propOrElse("line.separator", "\n") /** Various well-known properties. */ - def javaClassPath = propOrEmpty("java.class.path") - def javaHome = propOrEmpty("java.home") - def javaVendor = propOrEmpty("java.vendor") - def javaVersion = propOrEmpty("java.version") - def javaVmInfo = propOrEmpty("java.vm.info") - def javaVmName = propOrEmpty("java.vm.name") - def javaVmVendor = propOrEmpty("java.vm.vendor") - def javaVmVersion = propOrEmpty("java.vm.version") - def osName = propOrEmpty("os.name") - def scalaHome = propOrEmpty("scala.home") - def tmpDir = propOrEmpty("java.io.tmpdir") - def userDir = propOrEmpty("user.dir") - def userHome = propOrEmpty("user.home") - def userName = propOrEmpty("user.name") + def javaClassPath: String = propOrEmpty("java.class.path") + def javaHome: String = propOrEmpty("java.home") + def javaVendor: String = propOrEmpty("java.vendor") + def javaVersion: String = propOrEmpty("java.version") + def javaVmInfo: String = propOrEmpty("java.vm.info") + def javaVmName: String = propOrEmpty("java.vm.name") + def javaVmVendor: String = propOrEmpty("java.vm.vendor") + def javaVmVersion: String = propOrEmpty("java.vm.version") + def osName: String = propOrEmpty("os.name") + def scalaHome: String = propOrEmpty("scala.home") + def tmpDir: String = propOrEmpty("java.io.tmpdir") + def userDir: String = propOrEmpty("user.dir") + def userHome: String = propOrEmpty("user.home") + def userName: String = propOrEmpty("user.name") /** Some derived values. */ - def isWin = osName startsWith "Windows" - def isMac = javaVendor startsWith "Apple" + def isWin: Boolean = osName startsWith "Windows" + def isMac: Boolean = javaVendor startsWith "Apple" // This is looking for javac, tools.jar, etc. // Tries JDK_HOME first, then the more common but likely jre JAVA_HOME, // and finally the system property based javaHome. - def jdkHome = envOrElse("JDK_HOME", envOrElse("JAVA_HOME", javaHome)) + def jdkHome: String = envOrElse("JDK_HOME", envOrElse("JAVA_HOME", javaHome)) - def versionMsg = "Scala %s %s -- %s".format(propCategory, versionString, copyrightString) - def scalaCmd = if (isWin) "dotr.bat" else "dotr" - def scalacCmd = if (isWin) "dotc.bat" else "dotc" + def versionMsg: String = "Scala %s %s -- %s".format(propCategory, versionString, copyrightString) + def scalaCmd: String = if (isWin) "dotr.bat" else "dotr" + def scalacCmd: String = if (isWin) "dotc.bat" else "dotc" } diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 93d93eddebc0..07a52d32a778 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -1,152 +1,152 @@ package dotty.tools.dotc package config -import dotty.tools.io.{ Directory, PlainDirectory } - +import dotty.tools.io.{ Directory, PlainDirectory, AbstractFile } import PathResolver.Defaults import rewrites.Rewrites +import Settings.Setting class ScalaSettings extends Settings.SettingGroup { - protected def defaultClasspath = sys.env.getOrElse("CLASSPATH", ".") + protected def defaultClasspath: String = sys.env.getOrElse("CLASSPATH", ".") /** Path related settings */ - val bootclasspath = PathSetting("-bootclasspath", "Override location of bootstrap class files.", Defaults.scalaBootClassPath) - val extdirs = PathSetting("-extdirs", "Override location of installed extensions.", Defaults.scalaExtDirs) - val javabootclasspath = PathSetting("-javabootclasspath", "Override java boot classpath.", Defaults.javaBootClassPath) - val javaextdirs = PathSetting("-javaextdirs", "Override java extdirs classpath.", Defaults.javaExtDirs) - val sourcepath = PathSetting("-sourcepath", "Specify location(s) of source files.", Defaults.scalaSourcePath) - val scansource = BooleanSetting("-scansource", "Scan source files to locate classes for which class-name != file-name") - - val classpath = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" - val outputDir = OutputSetting("-d", "directory|jar", "destination for generated classfiles.", + val bootclasspath: Setting[String] = PathSetting("-bootclasspath", "Override location of bootstrap class files.", Defaults.scalaBootClassPath) + val extdirs: Setting[String] = PathSetting("-extdirs", "Override location of installed extensions.", Defaults.scalaExtDirs) + val javabootclasspath: Setting[String] = PathSetting("-javabootclasspath", "Override java boot classpath.", Defaults.javaBootClassPath) + val javaextdirs: Setting[String] = PathSetting("-javaextdirs", "Override java extdirs classpath.", Defaults.javaExtDirs) + val sourcepath: Setting[String] = PathSetting("-sourcepath", "Specify location(s) of source files.", Defaults.scalaSourcePath) + val scansource: Setting[Boolean] = BooleanSetting("-scansource", "Scan source files to locate classes for which class-name != file-name") + + val classpath: Setting[String] = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" + val outputDir: Setting[AbstractFile] = OutputSetting("-d", "directory|jar", "destination for generated classfiles.", new PlainDirectory(Directory("."))) - val priorityclasspath = PathSetting("-priorityclasspath", "class path that takes precedence over all other paths (or testing only)", "") + val priorityclasspath: Setting[String] = PathSetting("-priorityclasspath", "class path that takes precedence over all other paths (or testing only)", "") /** Other settings */ - val deprecation = BooleanSetting("-deprecation", "Emit warning and location for usages of deprecated APIs.") - val migration = BooleanSetting("-migration", "Emit warning and location for migration issues from Scala 2.") - val encoding = StringSetting("-encoding", "encoding", "Specify character encoding used by source files.", Properties.sourceEncoding) - val explainTypes = BooleanSetting("-explain-types", "Explain type errors in more detail.") - val explain = BooleanSetting("-explain", "Explain errors in more detail.") - val feature = BooleanSetting("-feature", "Emit warning and location for usages of features that should be imported explicitly.") - val help = BooleanSetting("-help", "Print a synopsis of standard options") - val color = ChoiceSetting("-color", "mode", "Colored output", List("always", "never"/*, "auto"*/), "always"/* "auto"*/) - val target = ChoiceSetting("-target", "target", "Target platform for object files. All JVM 1.5 targets are deprecated.", + val deprecation: Setting[Boolean] = BooleanSetting("-deprecation", "Emit warning and location for usages of deprecated APIs.") + val migration: Setting[Boolean] = BooleanSetting("-migration", "Emit warning and location for migration issues from Scala 2.") + val encoding: Setting[String] = StringSetting("-encoding", "encoding", "Specify character encoding used by source files.", Properties.sourceEncoding) + val explainTypes: Setting[Boolean] = BooleanSetting("-explain-types", "Explain type errors in more detail.") + val explain: Setting[Boolean] = BooleanSetting("-explain", "Explain errors in more detail.") + val feature: Setting[Boolean] = BooleanSetting("-feature", "Emit warning and location for usages of features that should be imported explicitly.") + val help: Setting[Boolean] = BooleanSetting("-help", "Print a synopsis of standard options") + val color: Setting[String] = ChoiceSetting("-color", "mode", "Colored output", List("always", "never"/*, "auto"*/), "always"/* "auto"*/) + val target: Setting[String] = ChoiceSetting("-target", "target", "Target platform for object files. All JVM 1.5 targets are deprecated.", List("jvm-1.5", "jvm-1.5-fjbg", "jvm-1.5-asm", "jvm-1.6", "jvm-1.7", "jvm-1.8", "msil"), "jvm-1.8") - val unchecked = BooleanSetting("-unchecked", "Enable additional warnings where generated code depends on assumptions.") - val uniqid = BooleanSetting("-uniqid", "Uniquely tag all identifiers in debugging output.") - val usejavacp = BooleanSetting("-usejavacp", "Utilize the java.class.path in classpath resolution.") - val verbose = BooleanSetting("-verbose", "Output messages about what the compiler is doing.") - val version = BooleanSetting("-version", "Print product version and exit.") - val pageWidth = IntSetting("-pagewidth", "Set page width", 80) - val strict = BooleanSetting("-strict", "Use strict type rules, which means some formerly legal code does not typecheck anymore.") - val language = MultiStringSetting("-language", "feature", "Enable one or more language features.") - val rewrite = OptionSetting[Rewrites]("-rewrite", "When used in conjunction with -language:Scala2 rewrites sources to migrate to new syntax") - val silentWarnings = BooleanSetting("-nowarn", "Silence all warnings.") - val fromTasty = BooleanSetting("-from-tasty", "Compile classes from tasty in classpath. The arguments are used as class names.") + val unchecked: Setting[Boolean] = BooleanSetting("-unchecked", "Enable additional warnings where generated code depends on assumptions.") + val uniqid: Setting[Boolean] = BooleanSetting("-uniqid", "Uniquely tag all identifiers in debugging output.") + val usejavacp: Setting[Boolean] = BooleanSetting("-usejavacp", "Utilize the java.class.path in classpath resolution.") + val verbose: Setting[Boolean] = BooleanSetting("-verbose", "Output messages about what the compiler is doing.") + val version: Setting[Boolean] = BooleanSetting("-version", "Print product version and exit.") + val pageWidth: Setting[Int] = IntSetting("-pagewidth", "Set page width", 80) + val strict: Setting[Boolean] = BooleanSetting("-strict", "Use strict type rules, which means some formerly legal code does not typecheck anymore.") + val language: Setting[List[String]] = MultiStringSetting("-language", "feature", "Enable one or more language features.") + val rewrite: Setting[Option[Rewrites]] = OptionSetting[Rewrites]("-rewrite", "When used in conjunction with -language:Scala2 rewrites sources to migrate to new syntax") + val silentWarnings: Setting[Boolean] = BooleanSetting("-nowarn", "Silence all warnings.") + val fromTasty: Setting[Boolean] = BooleanSetting("-from-tasty", "Compile classes from tasty in classpath. The arguments are used as class names.") /** Decompiler settings */ - val printTasty = BooleanSetting("-print-tasty", "Prints the raw tasty.") - val printLines = BooleanSetting("-print-lines", "Show source code line numbers.") + val printTasty: Setting[Boolean] = BooleanSetting("-print-tasty", "Prints the raw tasty.") + val printLines: Setting[Boolean] = BooleanSetting("-print-lines", "Show source code line numbers.") /** Plugin-related setting */ - val plugin = MultiStringSetting ("-Xplugin", "paths", "Load a plugin from each classpath.") - val disable = MultiStringSetting ("-Xplugin-disable", "plugin", "Disable plugins by name.") - val require = MultiStringSetting ("-Xplugin-require", "plugin", "Abort if a named plugin is not loaded.") - val showPlugins = BooleanSetting ("-Xplugin-list", "Print a synopsis of loaded plugins.") - val pluginsDir = StringSetting ("-Xpluginsdir", "path", "Path to search for plugin archives.", Defaults.scalaPluginPath) - val pluginOptions = MultiStringSetting ("-P", "plugin:opt", "Pass an option to a plugin, e.g. -P::") + val plugin: Setting[List[String]] = MultiStringSetting ("-Xplugin", "paths", "Load a plugin from each classpath.") + val disable: Setting[List[String]] = MultiStringSetting ("-Xplugin-disable", "plugin", "Disable plugins by name.") + val require: Setting[List[String]] = MultiStringSetting ("-Xplugin-require", "plugin", "Abort if a named plugin is not loaded.") + val showPlugins: Setting[Boolean] = BooleanSetting ("-Xplugin-list", "Print a synopsis of loaded plugins.") + val pluginsDir: Setting[String] = StringSetting ("-Xpluginsdir", "path", "Path to search for plugin archives.", Defaults.scalaPluginPath) + val pluginOptions: Setting[List[String]] = MultiStringSetting ("-P", "plugin:opt", "Pass an option to a plugin, e.g. -P::") /** -X "Advanced" settings */ - val Xhelp = BooleanSetting("-X", "Print a synopsis of advanced options.") - val XnoForwarders = BooleanSetting("-Xno-forwarders", "Do not generate static forwarders in mirror classes.") - val XminImplicitSearchDepth = IntSetting("-Xmin-implicit-search-depth", "Set number of levels of implicit searches undertaken before checking for divergence.", 5) - val XmaxInlines = IntSetting("-Xmax-inlines", "Maximal number of successive inlines", 32) - val XmaxClassfileName = IntSetting("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, 72 to 255) - val Xmigration = VersionSetting("-Xmigration", "Warn about constructs whose behavior may have changed since version.") - val Xprint = PhasesSetting("-Xprint", "Print out program after") - val XprintTypes = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") - val XprintDiff = BooleanSetting("-Xprint-diff", "Print changed parts of the tree since last print.") - val XprintDiffDel = BooleanSetting("-Xprint-diff-del", "Print changed parts of the tree since last print including deleted parts.") - val Xprompt = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") - val XmainClass = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d )", "") - val XnoValueClasses = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.") - val XreplLineWidth = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390) - val XfatalWarnings = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.") - val XverifySignatures = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.") + val Xhelp: Setting[Boolean] = BooleanSetting("-X", "Print a synopsis of advanced options.") + val XnoForwarders: Setting[Boolean] = BooleanSetting("-Xno-forwarders", "Do not generate static forwarders in mirror classes.") + val XminImplicitSearchDepth: Setting[Int] = IntSetting("-Xmin-implicit-search-depth", "Set number of levels of implicit searches undertaken before checking for divergence.", 5) + val XmaxInlines: Setting[Int] = IntSetting("-Xmax-inlines", "Maximal number of successive inlines", 32) + val XmaxClassfileName: Setting[Int] = IntSetting("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, 72 to 255) + val Xmigration: Setting[ScalaVersion] = VersionSetting("-Xmigration", "Warn about constructs whose behavior may have changed since version.") + val Xprint: Setting[List[String]] = PhasesSetting("-Xprint", "Print out program after") + val XprintTypes: Setting[Boolean] = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") + val XprintDiff: Setting[Boolean] = BooleanSetting("-Xprint-diff", "Print changed parts of the tree since last print.") + val XprintDiffDel: Setting[Boolean] = BooleanSetting("-Xprint-diff-del", "Print changed parts of the tree since last print including deleted parts.") + val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") + val XmainClass: Setting[String] = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d )", "") + val XnoValueClasses: Setting[Boolean] = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.") + val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390) + val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.") + val XverifySignatures: Setting[Boolean] = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.") /** -Y "Private" settings */ - val YoverrideVars = BooleanSetting("-Yoverride-vars", "Allow vars to be overridden.") - val Yhelp = BooleanSetting("-Y", "Print a synopsis of private options.") - val Ycheck = PhasesSetting("-Ycheck", "Check the tree at the end of") - val YcheckMods = BooleanSetting("-Ycheck-mods", "Check that symbols and their defining trees have modifiers in sync") - val Ydebug = BooleanSetting("-Ydebug", "Increase the quantity of debugging output.") - val YdebugTrace = BooleanSetting("-Ydebug-trace", "Trace core operations") - val YdebugFlags = BooleanSetting("-Ydebug-flags", "Print all flags of definitions") - val YdebugMissingRefs = BooleanSetting("-Ydebug-missing-refs", "Print a stacktrace when a required symbol is missing") - val YdebugNames = BooleanSetting("-Ydebug-names", "Show internal representation of names") - val YtermConflict = ChoiceSetting("-Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error") - val Ylog = PhasesSetting("-Ylog", "Log operations during") - val YemitTastyInClass = BooleanSetting("-Yemit-tasty-in-class", "Generate tasty in the .class file and add an empty *.hasTasty file.") - val YlogClasspath = BooleanSetting("-Ylog-classpath", "Output information about what classpath is being applied.") - val YdisableFlatCpCaching = BooleanSetting("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.") - - val Yscala2Unpickler = StringSetting("-Yscala2-unpickler", "", "Control where we may get Scala 2 symbols from. This is either \"always\", \"never\", or a classpath.", "always") - - val YnoImports = BooleanSetting("-Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.") - val YnoInline = BooleanSetting("-Yno-inline", "Suppress inlining.") - val YnoGenericSig = BooleanSetting("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.") - val YnoPredef = BooleanSetting("-Yno-predef", "Compile without importing Predef.") - val Yskip = PhasesSetting("-Yskip", "Skip") - val Ydumpclasses = StringSetting("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") - val YstopAfter = PhasesSetting("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat - val YstopBefore = PhasesSetting("-Ystop-before", "Stop before") // stop before erasure as long as we have not debugged it fully - val YtraceContextCreation = BooleanSetting("-Ytrace-context-creation", "Store stack trace of context creations.") - val YshowSuppressedErrors = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally suppressed.") - val YdetailedStats = BooleanSetting("-Ydetailed-stats", "show detailed internal compiler stats (needs Stats.enabled to be set to true).") - val Yheartbeat = BooleanSetting("-Ydetailed-stats", "show heartbeat stack trace of compiler operations (needs Stats.enabled to be set to true).") - val YprintPos = BooleanSetting("-Yprint-pos", "show tree positions.") - val YprintPosSyms = BooleanSetting("-Yprint-pos-syms", "show symbol definitions positions.") - val YnoDeepSubtypes = BooleanSetting("-Yno-deep-subtypes", "throw an exception on deep subtyping call stacks.") - val YnoPatmatOpt = BooleanSetting("-Yno-patmat-opt", "disable all pattern matching optimizations.") - val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.") - val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.") - val YprintDebug = BooleanSetting("-Yprint-debug", "when printing trees, print some extra information useful for debugging.") - val YprintDebugOwners = BooleanSetting("-Yprint-debug-owners", "when printing trees, print owners of definitions.") - val YshowPrintErrors = BooleanSetting("-Yshow-print-errors", "don't suppress exceptions thrown during tree printing.") - val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler") - val YcheckReentrant = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.") - val YdropComments = BooleanSetting("-Ydrop-comments", "Drop comments when scanning source files.") - val YcookComments = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)") - val YforceSbtPhases = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.") - val YdumpSbtInc = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.") - val YcheckAllPatmat = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm)") - val YretainTrees = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree") - val YshowTreeIds = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.") - - val YprofileEnabled = BooleanSetting("-Yprofile-enabled", "Enable profiling.") - val YprofileDestination = StringSetting("-Yprofile-destination", "file", "where to send profiling output - specify a file, default is to the console.", "") + val YoverrideVars: Setting[Boolean] = BooleanSetting("-Yoverride-vars", "Allow vars to be overridden.") + val Yhelp: Setting[Boolean] = BooleanSetting("-Y", "Print a synopsis of private options.") + val Ycheck: Setting[List[String]] = PhasesSetting("-Ycheck", "Check the tree at the end of") + val YcheckMods: Setting[Boolean] = BooleanSetting("-Ycheck-mods", "Check that symbols and their defining trees have modifiers in sync") + val Ydebug: Setting[Boolean] = BooleanSetting("-Ydebug", "Increase the quantity of debugging output.") + val YdebugTrace: Setting[Boolean] = BooleanSetting("-Ydebug-trace", "Trace core operations") + val YdebugFlags: Setting[Boolean] = BooleanSetting("-Ydebug-flags", "Print all flags of definitions") + val YdebugMissingRefs: Setting[Boolean] = BooleanSetting("-Ydebug-missing-refs", "Print a stacktrace when a required symbol is missing") + val YdebugNames: Setting[Boolean] = BooleanSetting("-Ydebug-names", "Show internal representation of names") + val YtermConflict: Setting[String] = ChoiceSetting("-Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error") + val Ylog: Setting[List[String]] = PhasesSetting("-Ylog", "Log operations during") + val YemitTastyInClass: Setting[Boolean] = BooleanSetting("-Yemit-tasty-in-class", "Generate tasty in the .class file and add an empty *.hasTasty file.") + val YlogClasspath: Setting[Boolean] = BooleanSetting("-Ylog-classpath", "Output information about what classpath is being applied.") + val YdisableFlatCpCaching: Setting[Boolean] = BooleanSetting("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.") + + val Yscala2Unpickler: Setting[String] = StringSetting("-Yscala2-unpickler", "", "Control where we may get Scala 2 symbols from. This is either \"always\", \"never\", or a classpath.", "always") + + val YnoImports: Setting[Boolean] = BooleanSetting("-Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.") + val YnoInline: Setting[Boolean] = BooleanSetting("-Yno-inline", "Suppress inlining.") + val YnoGenericSig: Setting[Boolean] = BooleanSetting("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.") + val YnoPredef: Setting[Boolean] = BooleanSetting("-Yno-predef", "Compile without importing Predef.") + val Yskip: Setting[List[String]] = PhasesSetting("-Yskip", "Skip") + val Ydumpclasses: Setting[String] = StringSetting("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") + val YstopAfter: Setting[List[String]] = PhasesSetting("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat + val YstopBefore: Setting[List[String]] = PhasesSetting("-Ystop-before", "Stop before") // stop before erasure as long as we have not debugged it fully + val YtraceContextCreation: Setting[Boolean] = BooleanSetting("-Ytrace-context-creation", "Store stack trace of context creations.") + val YshowSuppressedErrors: Setting[Boolean] = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally suppressed.") + val YdetailedStats: Setting[Boolean] = BooleanSetting("-Ydetailed-stats", "show detailed internal compiler stats (needs Stats.enabled to be set to true).") + val Yheartbeat: Setting[Boolean] = BooleanSetting("-Ydetailed-stats", "show heartbeat stack trace of compiler operations (needs Stats.enabled to be set to true).") + val YprintPos: Setting[Boolean] = BooleanSetting("-Yprint-pos", "show tree positions.") + val YprintPosSyms: Setting[Boolean] = BooleanSetting("-Yprint-pos-syms", "show symbol definitions positions.") + val YnoDeepSubtypes: Setting[Boolean] = BooleanSetting("-Yno-deep-subtypes", "throw an exception on deep subtyping call stacks.") + val YnoPatmatOpt: Setting[Boolean] = BooleanSetting("-Yno-patmat-opt", "disable all pattern matching optimizations.") + val YplainPrinter: Setting[Boolean] = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.") + val YprintSyms: Setting[Boolean] = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.") + val YprintDebug: Setting[Boolean] = BooleanSetting("-Yprint-debug", "when printing trees, print some extra information useful for debugging.") + val YprintDebugOwners: Setting[Boolean] = BooleanSetting("-Yprint-debug-owners", "when printing trees, print owners of definitions.") + val YshowPrintErrors: Setting[Boolean] = BooleanSetting("-Yshow-print-errors", "don't suppress exceptions thrown during tree printing.") + val YtestPickler: Setting[Boolean] = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler") + val YcheckReentrant: Setting[Boolean] = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.") + val YdropComments: Setting[Boolean] = BooleanSetting("-Ydrop-comments", "Drop comments when scanning source files.") + val YcookComments: Setting[Boolean] = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)") + val YforceSbtPhases: Setting[Boolean] = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.") + val YdumpSbtInc: Setting[Boolean] = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.") + val YcheckAllPatmat: Setting[Boolean] = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm)") + val YretainTrees: Setting[Boolean] = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree") + val YshowTreeIds: Setting[Boolean] = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.") + + val YprofileEnabled: Setting[Boolean] = BooleanSetting("-Yprofile-enabled", "Enable profiling.") + val YprofileDestination: Setting[String] = StringSetting("-Yprofile-destination", "file", "where to send profiling output - specify a file, default is to the console.", "") //.withPostSetHook( _ => YprofileEnabled.value = true ) - val YprofileExternalTool = PhasesSetting("-Yprofile-external-tool", "Enable profiling for a phase using an external tool hook. Generally only useful for a single phase", "typer") + val YprofileExternalTool: Setting[List[String]] = PhasesSetting("-Yprofile-external-tool", "Enable profiling for a phase using an external tool hook. Generally only useful for a single phase", "typer") //.withPostSetHook( _ => YprofileEnabled.value = true ) - val YprofileRunGcBetweenPhases = PhasesSetting("-Yprofile-run-gc", "Run a GC between phases - this allows heap size to be accurate at the expense of more time. Specify a list of phases, or *", "_") + val YprofileRunGcBetweenPhases: Setting[List[String]] = PhasesSetting("-Yprofile-run-gc", "Run a GC between phases - this allows heap size to be accurate at the expense of more time. Specify a list of phases, or *", "_") //.withPostSetHook( _ => YprofileEnabled.value = true ) // Extremely experimental language features - val YkindPolymorphism = BooleanSetting("-Ykind-polymorphism", "Enable kind polymorphism (see http://dotty.epfl.ch/docs/reference/kind-polymorphism.html). Potentially unsound.") + val YkindPolymorphism: Setting[Boolean] = BooleanSetting("-Ykind-polymorphism", "Enable kind polymorphism (see http://dotty.epfl.ch/docs/reference/kind-polymorphism.html). Potentially unsound.") /** Area-specific debug output */ - val YexplainLowlevel = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.") - val YnoDoubleBindings = BooleanSetting("-Yno-double-bindings", "Assert no namedtype is bound twice (should be enabled only if program is error-free).") - val YshowVarBounds = BooleanSetting("-Yshow-var-bounds", "Print type variables with their bounds") - val YshowNoInline = BooleanSetting("-Yshow-no-inline", "Show inlined code without the 'inlined from' info") + val YexplainLowlevel: Setting[Boolean] = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.") + val YnoDoubleBindings: Setting[Boolean] = BooleanSetting("-Yno-double-bindings", "Assert no namedtype is bound twice (should be enabled only if program is error-free).") + val YshowVarBounds: Setting[Boolean] = BooleanSetting("-Yshow-var-bounds", "Print type variables with their bounds") + val YshowNoInline: Setting[Boolean] = BooleanSetting("-Yshow-no-inline", "Show inlined code without the 'inlined from' info") - val YnoDecodeStacktraces = BooleanSetting("-Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.") + val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting("-Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.") /** Dottydoc specific settings */ - val siteRoot = StringSetting( + val siteRoot: Setting[String] = StringSetting( "-siteroot", "site root", "A directory containing static files from which to generate documentation", @@ -154,26 +154,26 @@ class ScalaSettings extends Settings.SettingGroup { ) - val projectName = StringSetting ( + val projectName: Setting[String] = StringSetting ( "-project", "project title", "The name of the project", "" ) - val projectVersion = StringSetting ( + val projectVersion: Setting[String] = StringSetting ( "-project-version", "project version", "The current version of your project", "" ) - val projectUrl = StringSetting ( + val projectUrl: Setting[String] = StringSetting ( "-project-url", "project repository homepage", "The source repository of your project", "" ) - val wikiSyntax = BooleanSetting("-Xwiki-syntax", "Retains the Scala2 behavior of using Wiki Syntax in Scaladoc") + val wikiSyntax: Setting[Boolean] = BooleanSetting("-Xwiki-syntax", "Retains the Scala2 behavior of using Wiki Syntax in Scaladoc") } diff --git a/compiler/src/dotty/tools/dotc/config/ScalaVersion.scala b/compiler/src/dotty/tools/dotc/config/ScalaVersion.scala index 9bb7431d5384..8ba3dce8306a 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaVersion.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaVersion.scala @@ -18,7 +18,7 @@ sealed abstract class ScalaVersion extends Ordered[ScalaVersion] { * A scala version that sorts higher than all actual versions */ @sharable case object NoScalaVersion extends ScalaVersion { - def unparse = "none" + def unparse: String = "none" def compare(that: ScalaVersion): Int = that match { case NoScalaVersion => 0 @@ -33,7 +33,7 @@ sealed abstract class ScalaVersion extends Ordered[ScalaVersion] { * to segregate builds */ case class SpecificScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBuild) extends ScalaVersion { - def unparse = s"${major}.${minor}.${rev}.${build.unparse}" + def unparse: String = s"${major}.${minor}.${rev}.${build.unparse}" def compare(that: ScalaVersion): Int = that match { case SpecificScalaVersion(thatMajor, thatMinor, thatRev, thatBuild) => @@ -55,7 +55,7 @@ case class SpecificScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBu * A Scala version that sorts lower than all actual versions */ @sharable case object AnyScalaVersion extends ScalaVersion { - def unparse = "any" + def unparse: String = "any" def compare(that: ScalaVersion): Int = that match { case AnyScalaVersion => 0 @@ -110,7 +110,7 @@ case class SpecificScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBu /** * The version of the compiler running now */ - val current = parse(util.Properties.versionNumberString).get + val current: ScalaVersion = parse(util.Properties.versionNumberString).get } /** @@ -129,9 +129,9 @@ object ScalaBuild { /** A development, test, nightly, snapshot or other "unofficial" build */ case class Development(id: String) extends ScalaBuild { - def unparse = s"-${id}" + def unparse: String = s"-${id}" - def compare(that: ScalaBuild) = that match { + def compare(that: ScalaBuild): Int = that match { // sorting two development builds based on id is reasonably valid for two versions created with the same schema // otherwise it's not correct, but since it's impossible to put a total ordering on development build versions // this is a pragmatic compromise @@ -145,9 +145,9 @@ object ScalaBuild { /** A final build */ case object Final extends ScalaBuild { - def unparse = "" + def unparse: String = "" - def compare(that: ScalaBuild) = that match { + def compare(that: ScalaBuild): Int = that match { case Final => 0 // a final is newer than anything other than a development build or another final case Development(_) => -1 @@ -158,9 +158,9 @@ object ScalaBuild { /** A candidate for final release */ case class RC(n: Int) extends ScalaBuild { - def unparse = s"-RC${n}" + def unparse: String = s"-RC${n}" - def compare(that: ScalaBuild) = that match { + def compare(that: ScalaBuild): Int = that match { // compare two rcs based on their RC numbers case RC(thatN) => n - thatN // an rc is older than anything other than a milestone or another rc @@ -172,9 +172,9 @@ object ScalaBuild { /** An intermediate release */ case class Milestone(n: Int) extends ScalaBuild { - def unparse = s"-M${n}" + def unparse: String = s"-M${n}" - def compare(that: ScalaBuild) = that match { + def compare(that: ScalaBuild): Int = that match { // compare two milestones based on their milestone numbers case Milestone(thatN) => n - thatN // a milestone is older than anything other than another milestone diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index d8243e8beb4f..43d8e1b32d95 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -1,7 +1,7 @@ package dotty.tools.dotc package config -import collection.mutable.{ ArrayBuffer } +import collection.mutable.ArrayBuffer import scala.util.{ Success, Failure } import reflect.ClassTag import core.Contexts._ @@ -16,19 +16,19 @@ import language.existentials object Settings { - val BooleanTag = ClassTag.Boolean - val IntTag = ClassTag.Int - val StringTag = ClassTag(classOf[String]) - val ListTag = ClassTag(classOf[List[_]]) - val VersionTag = ClassTag(classOf[ScalaVersion]) - val OptionTag = ClassTag(classOf[Option[_]]) - val OutputTag = ClassTag(classOf[AbstractFile]) + val BooleanTag: ClassTag[Boolean] = ClassTag.Boolean + val IntTag: ClassTag[Int] = ClassTag.Int + val StringTag: ClassTag[Nothing] = ClassTag(classOf[String]) + val ListTag: ClassTag[Nothing] = ClassTag(classOf[List[_]]) + val VersionTag: ClassTag[Nothing] = ClassTag(classOf[ScalaVersion]) + val OptionTag: ClassTag[Nothing] = ClassTag(classOf[Option[_]]) + val OutputTag: ClassTag[Nothing] = ClassTag(classOf[AbstractFile]) class SettingsState(initialValues: Seq[Any]) { private[this] var values = ArrayBuffer(initialValues: _*) private[this] var _wasRead: Boolean = false - override def toString = s"SettingsState(values: ${values.toList})" + override def toString: String = s"SettingsState(values: ${values.toList})" def value(idx: Int): Any = { _wasRead = true @@ -50,10 +50,10 @@ object Settings { errors: List[String], warnings: List[String]) { - def fail(msg: String) = + def fail(msg: String): Settings.ArgsSummary = ArgsSummary(sstate, arguments.tail, errors :+ msg, warnings) - def warn(msg: String) = + def warn(msg: String): Settings.ArgsSummary = ArgsSummary(sstate, arguments.tail, errors, warnings :+ msg) } @@ -193,15 +193,15 @@ object Settings { class SettingGroup { - val _allSettings = new ArrayBuffer[Setting[_]] + val _allSettings: ArrayBuffer[Setting[T1] forSome { type T1 }] = new ArrayBuffer[Setting[_]] def allSettings: Seq[Setting[_]] = _allSettings - def defaultState = new SettingsState(allSettings map (_.default)) + def defaultState: SettingsState = new SettingsState(allSettings map (_.default)) - def userSetSettings(state: SettingsState) = + def userSetSettings(state: SettingsState): Seq[Setting[T1] forSome { type T1 }] = allSettings filterNot (_.isDefaultIn(state)) - def toConciseString(state: SettingsState) = + def toConciseString(state: SettingsState): String = userSetSettings(state).mkString("(", " ", ")") private def checkDependencies(state: ArgsSummary): ArgsSummary = diff --git a/compiler/src/dotty/tools/dotc/config/WrappedProperties.scala b/compiler/src/dotty/tools/dotc/config/WrappedProperties.scala index 07972b99b937..e80052872e7c 100644 --- a/compiler/src/dotty/tools/dotc/config/WrappedProperties.scala +++ b/compiler/src/dotty/tools/dotc/config/WrappedProperties.scala @@ -11,15 +11,15 @@ import java.security.AccessControlException trait WrappedProperties extends PropertiesTrait { def wrap[T](body: => T): Option[T] - protected def propCategory = "wrapped" - protected def pickJarBasedOn = this.getClass + protected def propCategory: String = "wrapped" + protected def pickJarBasedOn: Class[_] = this.getClass - override def propIsSet(name: String) = wrap(super.propIsSet(name)) exists (x => x) - override def propOrElse(name: String, alt: String) = wrap(super.propOrElse(name, alt)) getOrElse alt - override def setProp(name: String, value: String) = wrap(super.setProp(name, value)).orNull - override def clearProp(name: String) = wrap(super.clearProp(name)).orNull - override def envOrElse(name: String, alt: String) = wrap(super.envOrElse(name, alt)) getOrElse alt - override def envOrNone(name: String) = wrap(super.envOrNone(name)).flatten + override def propIsSet(name: String): Boolean = wrap(super.propIsSet(name)) exists (x => x) + override def propOrElse(name: String, alt: String): String = wrap(super.propOrElse(name, alt)) getOrElse alt + override def setProp(name: String, value: String): String = wrap(super.setProp(name, value)).orNull + override def clearProp(name: String): String = wrap(super.clearProp(name)).orNull + override def envOrElse(name: String, alt: String): String = wrap(super.envOrElse(name, alt)) getOrElse alt + override def envOrNone(name: String): Option[String] = wrap(super.envOrNone(name)).flatten def systemProperties: Iterator[(String, String)] = { import scala.collection.JavaConverters._ @@ -29,6 +29,6 @@ trait WrappedProperties extends PropertiesTrait { object WrappedProperties { object AccessControl extends WrappedProperties { - def wrap[T](body: => T) = try Some(body) catch { case _: AccessControlException => None } + def wrap[T](body: => T): Option[T] = try Some(body) catch { case _: AccessControlException => None } } } diff --git a/compiler/src/dotty/tools/dotc/core/Annotations.scala b/compiler/src/dotty/tools/dotc/core/Annotations.scala index 6aae44177979..89881802b582 100644 --- a/compiler/src/dotty/tools/dotc/core/Annotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Annotations.scala @@ -5,6 +5,7 @@ import Symbols._, Types._, Contexts._, Constants._, ast.tpd._ import config.ScalaVersion import StdNames._ import dotty.tools.dotc.ast.tpd +import scala.util.Try object Annotations { @@ -19,10 +20,10 @@ object Annotations { def appliesToModule: Boolean = true // for now; see remark in SymDenotations - def derivedAnnotation(tree: Tree)(implicit ctx: Context) = + def derivedAnnotation(tree: Tree)(implicit ctx: Context): Annotation = if (tree eq this.tree) this else Annotation(tree) - def arguments(implicit ctx: Context) = ast.tpd.arguments(tree) + def arguments(implicit ctx: Context): List[Tree] = ast.tpd.arguments(tree) def argument(i: Int)(implicit ctx: Context): Option[Tree] = { val args = arguments @@ -35,7 +36,7 @@ object Annotations { def ensureCompleted(implicit ctx: Context): Unit = tree - def sameAnnotation(that: Annotation)(implicit ctx: Context) = + def sameAnnotation(that: Annotation)(implicit ctx: Context): Boolean = symbol == that.symbol && tree.sameTree(that.tree) } @@ -48,12 +49,12 @@ object Annotations { def complete(implicit ctx: Context): Tree private[this] var myTree: Tree = null - def tree(implicit ctx: Context) = { + def tree(implicit ctx: Context): Tree = { if (myTree == null) myTree = complete(ctx) myTree } - override def isEvaluated = myTree != null + override def isEvaluated: Boolean = myTree != null } /** An annotation indicating the body of a right-hand side, @@ -61,21 +62,21 @@ object Annotations { * pickling/unpickling and TypeTreeMaps */ abstract class BodyAnnotation extends Annotation { - override def symbol(implicit ctx: Context) = defn.BodyAnnot - override def derivedAnnotation(tree: Tree)(implicit ctx: Context) = + override def symbol(implicit ctx: Context): ClassSymbol = defn.BodyAnnot + override def derivedAnnotation(tree: Tree)(implicit ctx: Context): Annotation = if (tree eq this.tree) this else ConcreteBodyAnnotation(tree) - override def arguments(implicit ctx: Context) = Nil - override def ensureCompleted(implicit ctx: Context) = () + override def arguments(implicit ctx: Context): Nil.type = Nil + override def ensureCompleted(implicit ctx: Context): Unit = () } case class ConcreteBodyAnnotation(body: Tree) extends BodyAnnotation { - def tree(implicit ctx: Context) = body + def tree(implicit ctx: Context): Tree = body } case class LazyBodyAnnotation(private var bodyExpr: Context => Tree) extends BodyAnnotation { private[this] var evaluated = false private[this] var myBody: Tree = _ - def tree(implicit ctx: Context) = { + def tree(implicit ctx: Context): Tree = { if (evaluated) assert(myBody != null) else { evaluated = true @@ -84,12 +85,12 @@ object Annotations { } myBody } - override def isEvaluated = evaluated + override def isEvaluated: Boolean = evaluated } object Annotation { - def apply(tree: Tree) = ConcreteAnnotation(tree) + def apply(tree: Tree): Annotations.ConcreteAnnotation = ConcreteAnnotation(tree) def apply(cls: ClassSymbol)(implicit ctx: Context): Annotation = apply(cls, Nil) @@ -149,7 +150,7 @@ object Annotations { def deferredResolve(atp: Type, args: List[Tree])(implicit ctx: Context): Annotation = deferred(atp.classSymbol, implicit ctx => resolveConstructor(atp, args)) - def makeAlias(sym: TermSymbol)(implicit ctx: Context) = + def makeAlias(sym: TermSymbol)(implicit ctx: Context): Annotation = apply(defn.AliasAnnot, List( ref(TermRef(sym.owner.thisType, sym.name, sym)))) @@ -176,11 +177,11 @@ object Annotations { else None } - def makeSourceFile(path: String)(implicit ctx: Context) = + def makeSourceFile(path: String)(implicit ctx: Context): Annotation = apply(defn.SourceFileAnnot, Literal(Constant(path))) } - def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context) = { + def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context): Annotation = { val tref = cls.typeRef Annotation(defn.ThrowsAnnotType.appliedTo(tref), Ident(tref)) } @@ -190,20 +191,20 @@ object Annotations { */ implicit class AnnotInfo(val sym: Symbol) extends AnyVal { - def isDeprecated(implicit ctx: Context) = + def isDeprecated(implicit ctx: Context): Boolean = sym.hasAnnotation(defn.DeprecatedAnnot) - def deprecationMessage(implicit ctx: Context) = + def deprecationMessage(implicit ctx: Context): Option[String] = for (annot <- sym.getAnnotation(defn.DeprecatedAnnot); arg <- annot.argumentConstant(0)) yield arg.stringValue - def migrationVersion(implicit ctx: Context) = + def migrationVersion(implicit ctx: Context): Option[Try[ScalaVersion]] = for (annot <- sym.getAnnotation(defn.MigrationAnnot); arg <- annot.argumentConstant(1)) yield ScalaVersion.parse(arg.stringValue) - def migrationMessage(implicit ctx: Context) = + def migrationMessage(implicit ctx: Context): Option[Try[ScalaVersion]] = for (annot <- sym.getAnnotation(defn.MigrationAnnot); arg <- annot.argumentConstant(0)) yield ScalaVersion.parse(arg.stringValue) diff --git a/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala b/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala index b427d5f0ffa2..bd4f77fae23a 100644 --- a/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala +++ b/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala @@ -11,9 +11,9 @@ import collection.mutable object CheckRealizable { abstract class Realizability(val msg: String) { - def andAlso(other: => Realizability) = + def andAlso(other: => Realizability): Realizability = if (this == Realizable) other else this - def mapError(f: Realizability => Realizability) = + def mapError(f: Realizability => Realizability): Realizability = if (this == Realizable) this else f(this) } @@ -43,10 +43,10 @@ object CheckRealizable { assert(problem != Realizable) } - def realizability(tp: Type)(implicit ctx: Context) = + def realizability(tp: Type)(implicit ctx: Context): Realizability = new CheckRealizable().realizability(tp) - def boundsRealizability(tp: Type)(implicit ctx: Context) = + def boundsRealizability(tp: Type)(implicit ctx: Context): Realizability = new CheckRealizable().boundsRealizability(tp) private val LateInitialized = Lazy | Erased, diff --git a/compiler/src/dotty/tools/dotc/core/Comments.scala b/compiler/src/dotty/tools/dotc/core/Comments.scala index d372423e9e66..6bb489550012 100644 --- a/compiler/src/dotty/tools/dotc/core/Comments.scala +++ b/compiler/src/dotty/tools/dotc/core/Comments.scala @@ -12,7 +12,7 @@ import parsing.Parsers.Parser import reporting.diagnostic.messages.ProperDefinitionNotFound object Comments { - val ContextDoc = new Key[ContextDocstrings] + val ContextDoc: Key[ContextDocstrings] = new Key[ContextDocstrings] /** Decorator for getting docbase out of context */ implicit class CommentsContext(val ctx: Context) extends AnyVal { @@ -26,7 +26,7 @@ object Comments { private[this] val _docstrings: MutableSymbolMap[Comment] = newMutableSymbolMap - val templateExpander = new CommentExpander + val templateExpander: CommentExpander = new CommentExpander def docstrings: Map[Symbol, Comment] = _docstrings.toMap @@ -54,7 +54,7 @@ object Comments { lazy val expandedBody: Option[String] = expanded.map(removeSections(_, "@usecase", "@define")) - val isDocComment = Comment.isDocComment(raw) + val isDocComment: Boolean = Comment.isDocComment(raw) /** * Expands this comment by giving its content to `f`, and then parsing the `@usecase` sections. @@ -398,7 +398,7 @@ object Comments { expandInternal(initialStr, 0).replaceAllLiterally("""\$""", "$") } - def defineVariables(sym: Symbol)(implicit ctx: Context) = { + def defineVariables(sym: Symbol)(implicit ctx: Context): Unit = { val Trim = "(?s)^[\\s&&[^\n\r]]*(.*?)\\s*$".r val raw = ctx.docCtx.flatMap(_.docstring(sym).map(_.raw)).getOrElse("") diff --git a/compiler/src/dotty/tools/dotc/core/Constants.scala b/compiler/src/dotty/tools/dotc/core/Constants.scala index 38cdac21d7fe..048fca394c95 100644 --- a/compiler/src/dotty/tools/dotc/core/Constants.scala +++ b/compiler/src/dotty/tools/dotc/core/Constants.scala @@ -3,6 +3,7 @@ package core import Types._, Symbols._, Contexts._ import printing.Printer +import printing.Texts.Text object Constants { @@ -27,15 +28,15 @@ object Constants { import java.lang.Double.doubleToRawLongBits import java.lang.Float.floatToRawIntBits - def isByteRange: Boolean = isIntRange && Byte.MinValue <= intValue && intValue <= Byte.MaxValue - def isShortRange: Boolean = isIntRange && Short.MinValue <= intValue && intValue <= Short.MaxValue - def isCharRange: Boolean = isIntRange && Char.MinValue <= intValue && intValue <= Char.MaxValue - def isIntRange: Boolean = ByteTag <= tag && tag <= IntTag - def isLongRange: Boolean = ByteTag <= tag && tag <= LongTag - def isFloatRange: Boolean = ByteTag <= tag && tag <= FloatTag - def isNumeric: Boolean = ByteTag <= tag && tag <= DoubleTag - def isNonUnitAnyVal = BooleanTag <= tag && tag <= DoubleTag - def isAnyVal = UnitTag <= tag && tag <= DoubleTag + def isByteRange: Boolean = isIntRange && Byte.MinValue <= intValue && intValue <= Byte.MaxValue + def isShortRange: Boolean = isIntRange && Short.MinValue <= intValue && intValue <= Short.MaxValue + def isCharRange: Boolean = isIntRange && Char.MinValue <= intValue && intValue <= Char.MaxValue + def isIntRange: Boolean = ByteTag <= tag && tag <= IntTag + def isLongRange: Boolean = ByteTag <= tag && tag <= LongTag + def isFloatRange: Boolean = ByteTag <= tag && tag <= FloatTag + def isNumeric: Boolean = ByteTag <= tag && tag <= DoubleTag + def isNonUnitAnyVal: Boolean = BooleanTag <= tag && tag <= DoubleTag + def isAnyVal: Boolean = UnitTag <= tag && tag <= DoubleTag def tpe(implicit ctx: Context): Type = tag match { case UnitTag => defn.UnitType @@ -62,7 +63,7 @@ object Constants { case _ => false } - def isNaN = value match { + def isNaN: Boolean = value match { case f: Float => f.isNaN case d: Double => d.isNaN case _ => false @@ -188,7 +189,7 @@ object Constants { def stringValue: String = value.toString - def toText(printer: Printer) = printer.toText(this) + def toText(printer: Printer): Text = printer.toText(this) def typeValue: Type = value.asInstanceOf[Type] def symbolValue: Symbol = value.asInstanceOf[Symbol] @@ -219,29 +220,29 @@ object Constants { finalizeHash(h, length = 2) } - override def toString = s"Constant($value)" - def canEqual(x: Any) = true - def get = value - def isEmpty = false - def _1 = value + override def toString: String = s"Constant($value)" + def canEqual(x: Any): Boolean = true + def get: Any = value + def isEmpty: Boolean = false + def _1: Any = value } object Constant { - def apply(x: Null) = new Constant(x, NullTag) - def apply(x: Unit) = new Constant(x, UnitTag) - def apply(x: Boolean) = new Constant(x, BooleanTag) - def apply(x: Byte) = new Constant(x, ByteTag) - def apply(x: Short) = new Constant(x, ShortTag) - def apply(x: Int) = new Constant(x, IntTag) - def apply(x: Long) = new Constant(x, LongTag) - def apply(x: Float) = new Constant(x, FloatTag) - def apply(x: Double) = new Constant(x, DoubleTag) - def apply(x: String) = new Constant(x, StringTag) - def apply(x: Char) = new Constant(x, CharTag) - def apply(x: Type) = new Constant(x, ClazzTag) - def apply(x: Symbol) = new Constant(x, EnumTag) - def apply(x: scala.Symbol) = new Constant(x, ScalaSymbolTag) - def apply(value: Any) = + def apply(x: Null): Constant = new Constant(x, NullTag) + def apply(x: Unit): Constant = new Constant(x, UnitTag) + def apply(x: Boolean): Constant = new Constant(x, BooleanTag) + def apply(x: Byte): Constant = new Constant(x, ByteTag) + def apply(x: Short): Constant = new Constant(x, ShortTag) + def apply(x: Int): Constant = new Constant(x, IntTag) + def apply(x: Long): Constant = new Constant(x, LongTag) + def apply(x: Float): Constant = new Constant(x, FloatTag) + def apply(x: Double): Constant = new Constant(x, DoubleTag) + def apply(x: String): Constant = new Constant(x, StringTag) + def apply(x: Char): Constant = new Constant(x, CharTag) + def apply(x: Type): Constant = new Constant(x, ClazzTag) + def apply(x: Symbol): Constant = new Constant(x, EnumTag) + def apply(x: scala.Symbol): Constant = new Constant(x, ScalaSymbolTag) + def apply(value: Any): Constant = new Constant(value, value match { case null => NullTag @@ -261,6 +262,6 @@ object Constants { } ) - def unapply(c: Constant) = c + def unapply(c: Constant): Constant = c } } diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala index ced16169fae6..aff9883cf294 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -31,7 +31,7 @@ trait ConstraintHandling { private[this] var addConstraintInvocations = 0 /** If the constraint is frozen we cannot add new bounds to the constraint. */ - protected var frozenConstraint = false + protected var frozenConstraint: Boolean = false /** Potentially a type lambda that is still instantiatable, even though the constraint * is generally frozen. @@ -43,7 +43,7 @@ trait ConstraintHandling { * Aligning means computing `S1 =:= S2` which may change the current constraint. * See note in TypeComparer#distributeAnd. */ - protected var homogenizeArgs = false + protected var homogenizeArgs: Boolean = false /** We are currently comparing type lambdas. Used as a flag for * optimization: when `false`, no need to do an expensive `pruneLambdaParams` diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala b/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala index 73924d0cf19d..e6caae72bdde 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala @@ -7,14 +7,14 @@ import config.Printers.{default, typr} trait ConstraintRunInfo { self: Run => private[this] var maxSize = 0 private[this] var maxConstraint: Constraint = _ - def recordConstraintSize(c: Constraint, size: Int) = + def recordConstraintSize(c: Constraint, size: Int): Unit = if (size > maxSize) { maxSize = size maxConstraint = c } - def printMaxConstraint()(implicit ctx: Context) = { + def printMaxConstraint()(implicit ctx: Context): Unit = { val printer = if (ctx.settings.YdetailedStats.value) default else typr if (maxSize > 0) printer.println(s"max constraint = ${maxConstraint.show}") } - protected def reset() = maxConstraint = null + protected def reset(): Unit = maxConstraint = null } diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index ae01828cd9f1..dba8f3159415 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -81,7 +81,7 @@ object Contexts { val base: ContextBase /** All outer contexts, ending in `base.initialCtx` and then `NoContext` */ - def outersIterator = new Iterator[Context] { + def outersIterator: AnyRef with Iterator[Context] { var current: Context; } = new Iterator[Context] { var current = thiscontext def hasNext = current != NoContext def next = { val c = current; current = current.outer; c } @@ -89,12 +89,12 @@ object Contexts { /** The outer context */ private[this] var _outer: Context = _ - protected def outer_=(outer: Context) = _outer = outer + protected def outer_=(outer: Context): Unit = _outer = outer def outer: Context = _outer /** The current context */ private[this] var _period: Period = _ - protected def period_=(period: Period) = { + protected def period_=(period: Period): Unit = { assert(period.firstPhaseId == period.lastPhaseId, period) _period = period } @@ -102,54 +102,54 @@ object Contexts { /** The scope nesting level */ private[this] var _mode: Mode = _ - protected def mode_=(mode: Mode) = _mode = mode + protected def mode_=(mode: Mode): Unit = _mode = mode def mode: Mode = _mode /** The current owner symbol */ private[this] var _owner: Symbol = _ - protected def owner_=(owner: Symbol) = _owner = owner + protected def owner_=(owner: Symbol): Unit = _owner = owner def owner: Symbol = _owner /** The current tree */ private[this] var _tree: Tree[_ >: Untyped]= _ - protected def tree_=(tree: Tree[_ >: Untyped]) = _tree = tree + protected def tree_=(tree: Tree[_ >: Untyped]): Unit = _tree = tree def tree: Tree[_ >: Untyped] = _tree /** The current scope */ private[this] var _scope: Scope = _ - protected def scope_=(scope: Scope) = _scope = scope + protected def scope_=(scope: Scope): Unit = _scope = scope def scope: Scope = _scope /** The current type comparer */ private[this] var _typerState: TyperState = _ - protected def typerState_=(typerState: TyperState) = _typerState = typerState + protected def typerState_=(typerState: TyperState): Unit = _typerState = typerState def typerState: TyperState = _typerState /** The current type assigner or typer */ private[this] var _typeAssigner: TypeAssigner = _ - protected def typeAssigner_=(typeAssigner: TypeAssigner) = _typeAssigner = typeAssigner + protected def typeAssigner_=(typeAssigner: TypeAssigner): Unit = _typeAssigner = typeAssigner def typeAssigner: TypeAssigner = _typeAssigner /** The currently active import info */ private[this] var _importInfo: ImportInfo = _ - protected def importInfo_=(importInfo: ImportInfo) = _importInfo = importInfo + protected def importInfo_=(importInfo: ImportInfo): Unit = _importInfo = importInfo def importInfo: ImportInfo = _importInfo /** The current bounds in force for type parameters appearing in a GADT */ private[this] var _gadt: GADTMap = _ - protected def gadt_=(gadt: GADTMap) = _gadt = gadt + protected def gadt_=(gadt: GADTMap): Unit = _gadt = gadt def gadt: GADTMap = _gadt /** The history of implicit searches that are currently active */ private[this] var _searchHistory: SearchHistory = null - protected def searchHistory_= (searchHistory: SearchHistory) = _searchHistory = searchHistory + protected def searchHistory_= (searchHistory: SearchHistory): Unit = _searchHistory = searchHistory def searchHistory: SearchHistory = _searchHistory /** The current type comparer. This ones updates itself automatically for * each new context. */ private[this] var _typeComparer: TypeComparer = _ - protected def typeComparer_=(typeComparer: TypeComparer) = _typeComparer = typeComparer + protected def typeComparer_=(typeComparer: TypeComparer): Unit = _typeComparer = typeComparer def typeComparer: TypeComparer = { if (_typeComparer.ctx ne this) _typeComparer = _typeComparer.copyIn(this) @@ -160,7 +160,7 @@ object Contexts { * Typically used for attributes that are read and written only in special situations. */ private[this] var _moreProperties: Map[Key[Any], Any] = _ - protected def moreProperties_=(moreProperties: Map[Key[Any], Any]) = _moreProperties = moreProperties + protected def moreProperties_=(moreProperties: Map[Key[Any], Any]): Unit = _moreProperties = moreProperties def moreProperties: Map[Key[Any], Any] = _moreProperties def property[T](key: Key[T]): Option[T] = @@ -172,7 +172,7 @@ object Contexts { * slightly slower than a normal field access would be. */ private var _store: Store = _ - protected def store_=(store: Store) = _store = store + protected def store_=(store: Store): Unit = _store = store def store: Store = _store /** The compiler callback implementation, or null if no callback will be called. */ @@ -252,10 +252,10 @@ object Contexts { final def withPhase(phase: Phase): Context = withPhase(phase.id) - final def withPhaseNoLater(phase: Phase) = + final def withPhaseNoLater(phase: Phase): Context = if (phase.exists && ctx.phase.id > phase.id) withPhase(phase) else ctx - final def withPhaseNoEarlier(phase: Phase) = + final def withPhaseNoEarlier(phase: Phase): Context = if (phase.exists && ctx.phase.id < phase.id) withPhase(phase) else ctx // `creationTrace`-related code. To enable, uncomment the code below and the @@ -365,13 +365,13 @@ object Contexts { } /** The context of expression `expr` seen as a member of a statement sequence */ - def exprContext(stat: Tree[_ >: Untyped], exprOwner: Symbol) = + def exprContext(stat: Tree[_ >: Untyped], exprOwner: Symbol): Context = if (exprOwner == this.owner) this else if (untpd.isSuperConstrCall(stat) && this.owner.isClass) superCallContext else ctx.fresh.setOwner(exprOwner) /** A new context that summarizes an import statement */ - def importContext(imp: Import[_], sym: Symbol) = { + def importContext(imp: Import[_], sym: Symbol): FreshContext = { val impNameOpt = imp.expr match { case ref: RefTree[_] => Some(ref.name.asTermName) case _ => None @@ -421,37 +421,37 @@ object Contexts { case None => fresh.dropProperty(key) } - override def toString = { + override def toString: String = { def iinfo(implicit ctx: Context) = if (ctx.importInfo == null) "" else i"${ctx.importInfo.selectors}%, %" "Context(\n" + (outersIterator map ( ctx => s" owner = ${ctx.owner}, scope = ${ctx.scope}, import = ${iinfo(ctx)}") mkString "\n") } - def typerPhase = base.typerPhase - def sbtExtractDependenciesPhase = base.sbtExtractDependenciesPhase - def picklerPhase = base.picklerPhase - def refchecksPhase = base.refchecksPhase - def patmatPhase = base.patmatPhase - def elimRepeatedPhase = base.elimRepeatedPhase - def extensionMethodsPhase = base.extensionMethodsPhase - def explicitOuterPhase = base.explicitOuterPhase - def gettersPhase = base.gettersPhase - def erasurePhase = base.erasurePhase - def elimErasedValueTypePhase = base.elimErasedValueTypePhase - def lambdaLiftPhase = base.lambdaLiftPhase - def flattenPhase = base.flattenPhase - def genBCodePhase = base.genBCodePhase - def phases = base.phases - - def settings = base.settings - def definitions = base.definitions - def platform = base.platform - def pendingUnderlying = base.pendingUnderlying - def uniqueNamedTypes = base.uniqueNamedTypes - def uniques = base.uniques - def nextId = base.nextId - - def initialize()(implicit ctx: Context) = base.initialize()(ctx) + def typerPhase: Phase = base.typerPhase + def sbtExtractDependenciesPhase: Phase = base.sbtExtractDependenciesPhase + def picklerPhase: Phase = base.picklerPhase + def refchecksPhase: Phase = base.refchecksPhase + def patmatPhase: Phase = base.patmatPhase + def elimRepeatedPhase: Phase = base.elimRepeatedPhase + def extensionMethodsPhase: Phase = base.extensionMethodsPhase + def explicitOuterPhase: Phase = base.explicitOuterPhase + def gettersPhase: Phase = base.gettersPhase + def erasurePhase: Phase = base.erasurePhase + def elimErasedValueTypePhase: Phase = base.elimErasedValueTypePhase + def lambdaLiftPhase: Phase = base.lambdaLiftPhase + def flattenPhase: Phase = base.flattenPhase + def genBCodePhase: Phase = base.genBCodePhase + def phases: Array[Phase] = base.phases + + def settings: ScalaSettings = base.settings + def definitions: Definitions = base.definitions + def platform: Platform = base.platform + def pendingUnderlying: mutable.HashSet[Type] = base.pendingUnderlying + def uniqueNamedTypes: Uniques.NamedTypeUniques = base.uniqueNamedTypes + def uniques: util.HashSet[Type] = base.uniques + def nextId: Int = base.nextId + + def initialize()(implicit ctx: Context): Unit = base.initialize()(ctx) } /** A condensed context provides only a small memory footprint over @@ -523,7 +523,7 @@ object Contexts { def setSetting[T](setting: Setting[T], value: T): this.type = setSettings(setting.updateIn(settingsState, value)) - def setDebug = setSetting(base.settings.Ydebug, true) + def setDebug: FreshContext = setSetting(base.settings.Ydebug, true) } implicit class ModeChanges(val c: Context) extends AnyVal { @@ -560,7 +560,7 @@ object Contexts { } @sharable object NoContext extends Context { - val base = null + val base: ContextBase = null override val implicits: ContextualImplicits = new ContextualImplicits(Nil, null)(this) } @@ -572,7 +572,7 @@ object Contexts { with Phases.PhasesBase { /** The applicable settings */ - val settings = new ScalaSettings + val settings: ScalaSettings = new ScalaSettings /** The initial context */ val initialCtx: Context = new InitialContext(this, settings) @@ -599,7 +599,7 @@ object Contexts { usePhases(List(SomePhase)) /** The standard definitions */ - val definitions = new Definitions + val definitions: Definitions = new Definitions /** Initializes the `ContextBase` with a starting context. * This initializes the `platform` and the `definitions`. @@ -619,22 +619,22 @@ object Contexts { // Symbols state /** A counter for unique ids */ - private[core] var _nextId = 0 + private[core] var _nextId: Int = 0 - def nextId = { _nextId += 1; _nextId } + def nextId: Int = { _nextId += 1; _nextId } // Types state /** A table for hash consing unique types */ - private[core] val uniques = new util.HashSet[Type](Config.initialUniquesCapacity) { + private[core] val uniques: util.HashSet[Type] = new util.HashSet[Type](Config.initialUniquesCapacity) { override def hash(x: Type): Int = x.hash override def isEqual(x: Type, y: Type) = x.eql(y) } /** A table for hash consing unique applied types */ - private[dotc] val uniqueAppliedTypes = new AppliedUniques + private[dotc] val uniqueAppliedTypes: AppliedUniques = new AppliedUniques /** A table for hash consing unique named types */ - private[core] val uniqueNamedTypes = new NamedTypeUniques + private[core] val uniqueNamedTypes: NamedTypeUniques = new NamedTypeUniques private def uniqueSets = Map( "uniques" -> uniques, @@ -660,13 +660,13 @@ object Contexts { /** The set of named types on which a currently active invocation * of underlying during a controlled operation exists. */ - private[core] val pendingUnderlying = new mutable.HashSet[Type] + private[core] val pendingUnderlying: mutable.HashSet[Type] = new mutable.HashSet[Type] /** A map from ErrorType to associated message computation. We use this map * instead of storing message computations directly in ErrorTypes in order * to avoid space leaks - the message computation usually captures a context. */ - private[core] val errorTypeMsg = mutable.Map[ErrorType, () => Message]() + private[core] val errorTypeMsg: mutable.Map[Types.ErrorType, () => Message] = mutable.Map[ErrorType, () => Message]() // Phases state @@ -685,14 +685,14 @@ object Contexts { // Printers state /** Number of recursive invocations of a show method on current stack */ - private[dotc] var toTextRecursions = 0 + private[dotc] var toTextRecursions: Int = 0 // Reporters state - private[dotc] var indent = 0 + private[dotc] var indent: Int = 0 - protected[dotc] val indentTab = " " + protected[dotc] val indentTab: String = " " - def reset() = { + def reset(): Unit = { for ((_, set) <- uniqueSets) set.clear() errorTypeMsg.clear() } @@ -703,7 +703,7 @@ object Contexts { @sharable private[this] var thread: Thread = null /** Check that we are on the same thread as before */ - def checkSingleThreaded() = + def checkSingleThreaded(): Unit = if (thread == null) thread = Thread.currentThread() else assert(thread == Thread.currentThread(), "illegal multithreaded access to ContextBase") } @@ -712,10 +712,10 @@ object Contexts { private[this] var myBounds = initBounds def setBounds(sym: Symbol, b: TypeBounds): Unit = myBounds = myBounds.updated(sym, b) - def bounds = myBounds + def bounds: SimpleIdentityMap[Symbol, TypeBounds] = myBounds } @sharable object EmptyGADTMap extends GADTMap(SimpleIdentityMap.Empty) { - override def setBounds(sym: Symbol, b: TypeBounds) = unsupported("EmptyGADTMap.setBounds") + override def setBounds(sym: Symbol, b: TypeBounds): Nothing = unsupported("EmptyGADTMap.setBounds") } } diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala index 606b27150bae..95b55ac14632 100644 --- a/compiler/src/dotty/tools/dotc/core/Decorators.scala +++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala @@ -143,7 +143,7 @@ object Decorators { } implicit class TextToString(val text: Text) extends AnyVal { - def show(implicit ctx: Context) = text.mkString(ctx.settings.pageWidth.value, ctx.settings.printLines.value) + def show(implicit ctx: Context): String = text.mkString(ctx.settings.pageWidth.value, ctx.settings.printLines.value) } /** Test whether a list of strings representing phases contains diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index d84c5b41579f..add3bfade3f0 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -7,13 +7,14 @@ import Flags._, Scopes._, Decorators._, NameOps._, Periods._ import unpickleScala2.Scala2Unpickler.ensureConstructor import scala.collection.mutable import collection.mutable +import Denotations.SingleDenotation object Definitions { /** The maximum number of elements in a tuple or product. * This should be removed once we go to hlists. */ - val MaxTupleArity = 22 + val MaxTupleArity: Int = 22 /** The maximum arity N of a function type that's implemented * as a trait `scala.FunctionN`. Functions of higher arity are possible, @@ -22,10 +23,10 @@ object Definitions { * The limit 22 is chosen for Scala2x interop. It could be something * else without affecting the set of programs that can be compiled. */ - val MaxImplementedFunctionArity = 22 + val MaxImplementedFunctionArity: Int = 22 /** The maximal arity of a function that can be accessed as member of a structural type */ - val MaxStructuralMethodArity = 7 + val MaxStructuralMethodArity: Int = 7 } /** A class defining symbols and types of standard definitions @@ -190,17 +191,17 @@ class Definitions { lazy val RootPackage: TermSymbol = ctx.newSymbol( NoSymbol, nme.ROOTPKG, PackageCreationFlags, TypeRef(NoPrefix, RootClass)) - lazy val EmptyPackageVal = ctx.newPackageSymbol( + lazy val EmptyPackageVal: Symbol { type ThisName = Names.TermName } = ctx.newPackageSymbol( RootClass, nme.EMPTY_PACKAGE, (emptypkg, emptycls) => ctx.base.rootLoader(emptypkg)).entered - lazy val EmptyPackageClass = EmptyPackageVal.moduleClass.asClass + lazy val EmptyPackageClass: ClassSymbol = EmptyPackageVal.moduleClass.asClass /** A package in which we can place all methods that are interpreted specially by the compiler */ - lazy val OpsPackageVal = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered - lazy val OpsPackageClass = OpsPackageVal.moduleClass.asClass + lazy val OpsPackageVal: Symbol { type ThisName = Names.TermName } = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered + lazy val OpsPackageClass: ClassSymbol = OpsPackageVal.moduleClass.asClass - lazy val ScalaPackageVal = ctx.requiredPackage(nme.scala_) - lazy val ScalaMathPackageVal = ctx.requiredPackage("scala.math") - lazy val ScalaPackageClass = { + lazy val ScalaPackageVal: TermSymbol = ctx.requiredPackage(nme.scala_) + lazy val ScalaMathPackageVal: TermSymbol = ctx.requiredPackage("scala.math") + lazy val ScalaPackageClass: ClassSymbol = { val cls = ScalaPackageVal.moduleClass.asClass cls.info.decls.openForMutations.useSynthesizer( name => ctx => @@ -208,22 +209,22 @@ class Definitions { else NoSymbol) cls } - lazy val ScalaPackageObjectRef = ctx.requiredModuleRef("scala.package") - lazy val JavaPackageVal = ctx.requiredPackage(nme.java) - lazy val JavaLangPackageVal = ctx.requiredPackage(jnme.JavaLang) + lazy val ScalaPackageObjectRef: Types.TermRef = ctx.requiredModuleRef("scala.package") + lazy val JavaPackageVal: TermSymbol = ctx.requiredPackage(nme.java) + lazy val JavaLangPackageVal: TermSymbol = ctx.requiredPackage(jnme.JavaLang) // fundamental modules - lazy val SysPackage = ctx.requiredModule("scala.sys.package") - lazy val Sys_errorR = SysPackage.moduleClass.requiredMethodRef(nme.error) - def Sys_error(implicit ctx: Context) = Sys_errorR.symbol - - lazy val TypelevelPackageObjectRef = ctx.requiredModuleRef("scala.typelevel.package") - lazy val TypelevelPackageObject = TypelevelPackageObjectRef.symbol.moduleClass - lazy val Typelevel_errorR = TypelevelPackageObjectRef.symbol.requiredMethodRef(nme.error) - def Typelevel_error(implicit ctx: Context) = Typelevel_errorR.symbol - lazy val Typelevel_constValueR = TypelevelPackageObjectRef.symbol.requiredMethodRef("constValue") - def Typelevel_constValue(implicit ctx: Context) = Typelevel_constValueR.symbol - lazy val Typelevel_constValueOptR = TypelevelPackageObjectRef.symbol.requiredMethodRef("constValueOpt") - def Typelevel_constValueOpt(implicit ctx: Context) = Typelevel_constValueOptR.symbol + lazy val SysPackage: TermSymbol = ctx.requiredModule("scala.sys.package") + lazy val Sys_errorR: Types.TermRef = SysPackage.moduleClass.requiredMethodRef(nme.error) + def Sys_error(implicit ctx: Context): Symbol = Sys_errorR.symbol + + lazy val TypelevelPackageObjectRef: Types.TermRef = ctx.requiredModuleRef("scala.typelevel.package") + lazy val TypelevelPackageObject: Symbol = TypelevelPackageObjectRef.symbol.moduleClass + lazy val Typelevel_errorR: Types.TermRef = TypelevelPackageObjectRef.symbol.requiredMethodRef(nme.error) + def Typelevel_error(implicit ctx: Context): Symbol = Typelevel_errorR.symbol + lazy val Typelevel_constValueR: Types.TermRef = TypelevelPackageObjectRef.symbol.requiredMethodRef("constValue") + def Typelevel_constValue(implicit ctx: Context): Symbol = Typelevel_constValueR.symbol + lazy val Typelevel_constValueOptR: Types.TermRef = TypelevelPackageObjectRef.symbol.requiredMethodRef("constValueOpt") + def Typelevel_constValueOpt(implicit ctx: Context): Symbol = Typelevel_constValueOptR.symbol /** The `scalaShadowing` package is used to safely modify classes and * objects in scala so that they can be used from dotty. They will @@ -232,8 +233,8 @@ class Definitions { * in `scalaShadowing` so they don't clash with the same-named `scala` * members at runtime. */ - lazy val ScalaShadowingPackageVal = ctx.requiredPackage(nme.scalaShadowing) - def ScalaShadowingPackageClass(implicit ctx: Context) = ScalaShadowingPackageVal.moduleClass.asClass + lazy val ScalaShadowingPackageVal: TermSymbol = ctx.requiredPackage(nme.scalaShadowing) + def ScalaShadowingPackageClass(implicit ctx: Context): ClassSymbol = ScalaShadowingPackageVal.moduleClass.asClass /** Note: We cannot have same named methods defined in Object and Any (and AnyVal, for that matter) * because after erasure the Any and AnyVal references get remapped to the Object methods @@ -258,23 +259,23 @@ class Definitions { * } */ lazy val AnyClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.Any, Abstract, Nil)) - def AnyType = AnyClass.typeRef + def AnyType: TypeRef = AnyClass.typeRef lazy val AnyValClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.AnyVal, Abstract, List(AnyClass.typeRef))) - def AnyValType = AnyValClass.typeRef - - lazy val Any_== = enterMethod(AnyClass, nme.EQ, methOfAny(BooleanType), Final) - lazy val Any_!= = enterMethod(AnyClass, nme.NE, methOfAny(BooleanType), Final) - lazy val Any_equals = enterMethod(AnyClass, nme.equals_, methOfAny(BooleanType)) - lazy val Any_hashCode = enterMethod(AnyClass, nme.hashCode_, MethodType(Nil, IntType)) - lazy val Any_toString = enterMethod(AnyClass, nme.toString_, MethodType(Nil, StringType)) - lazy val Any_## = enterMethod(AnyClass, nme.HASHHASH, ExprType(IntType), Final) - lazy val Any_getClass = enterMethod(AnyClass, nme.getClass_, MethodType(Nil, ClassClass.typeRef.appliedTo(TypeBounds.empty)), Final) - lazy val Any_isInstanceOf = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOf_, _ => BooleanType, Final) - lazy val Any_asInstanceOf = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOf_, _.paramRefs(0), Final) - lazy val Any_typeTest = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOfPM, _ => BooleanType, Final | Synthetic) + def AnyValType: TypeRef = AnyValClass.typeRef + + lazy val Any_== : TermSymbol = enterMethod(AnyClass, nme.EQ, methOfAny(BooleanType), Final) + lazy val Any_!= : TermSymbol = enterMethod(AnyClass, nme.NE, methOfAny(BooleanType), Final) + lazy val Any_equals: TermSymbol = enterMethod(AnyClass, nme.equals_, methOfAny(BooleanType)) + lazy val Any_hashCode: TermSymbol = enterMethod(AnyClass, nme.hashCode_, MethodType(Nil, IntType)) + lazy val Any_toString: TermSymbol = enterMethod(AnyClass, nme.toString_, MethodType(Nil, StringType)) + lazy val Any_## : TermSymbol = enterMethod(AnyClass, nme.HASHHASH, ExprType(IntType), Final) + lazy val Any_getClass: TermSymbol = enterMethod(AnyClass, nme.getClass_, MethodType(Nil, ClassClass.typeRef.appliedTo(TypeBounds.empty)), Final) + lazy val Any_isInstanceOf: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOf_, _ => BooleanType, Final) + lazy val Any_asInstanceOf: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOf_, _.paramRefs(0), Final) + lazy val Any_typeTest: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.isInstanceOfPM, _ => BooleanType, Final | Synthetic) // generated by pattern matcher, eliminated by erasure - def AnyMethods = List(Any_==, Any_!=, Any_equals, Any_hashCode, + def AnyMethods: List[Symbols.TermSymbol] = List(Any_==, Any_!=, Any_equals, Any_hashCode, Any_toString, Any_##, Any_getClass, Any_isInstanceOf, Any_asInstanceOf, Any_typeTest) lazy val ObjectClass: ClassSymbol = { @@ -291,27 +292,27 @@ class Definitions { completeClass(cls) } - def ObjectType = ObjectClass.typeRef + def ObjectType: TypeRef = ObjectClass.typeRef lazy val AnyRefAlias: TypeSymbol = enterAliasType(tpnme.AnyRef, ObjectType) - def AnyRefType = AnyRefAlias.typeRef + def AnyRefType: TypeRef = AnyRefAlias.typeRef - lazy val Object_eq = enterMethod(ObjectClass, nme.eq, methOfAnyRef(BooleanType), Final) - lazy val Object_ne = enterMethod(ObjectClass, nme.ne, methOfAnyRef(BooleanType), Final) - lazy val Object_synchronized = enterPolyMethod(ObjectClass, nme.synchronized_, 1, + lazy val Object_eq: TermSymbol = enterMethod(ObjectClass, nme.eq, methOfAnyRef(BooleanType), Final) + lazy val Object_ne: TermSymbol = enterMethod(ObjectClass, nme.ne, methOfAnyRef(BooleanType), Final) + lazy val Object_synchronized: TermSymbol = enterPolyMethod(ObjectClass, nme.synchronized_, 1, pt => MethodType(List(pt.paramRefs(0)), pt.paramRefs(0)), Final) - lazy val Object_clone = enterMethod(ObjectClass, nme.clone_, MethodType(Nil, ObjectType), Protected) - lazy val Object_finalize = enterMethod(ObjectClass, nme.finalize_, MethodType(Nil, UnitType), Protected) - lazy val Object_notify = enterMethod(ObjectClass, nme.notify_, MethodType(Nil, UnitType), Final) - lazy val Object_notifyAll = enterMethod(ObjectClass, nme.notifyAll_, MethodType(Nil, UnitType), Final) - lazy val Object_wait = enterMethod(ObjectClass, nme.wait_, MethodType(Nil, UnitType), Final) - lazy val Object_waitL = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: Nil, UnitType), Final) - lazy val Object_waitLI = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: IntType :: Nil, UnitType), Final) - - def ObjectMethods = List(Object_eq, Object_ne, Object_synchronized, Object_clone, + lazy val Object_clone: TermSymbol = enterMethod(ObjectClass, nme.clone_, MethodType(Nil, ObjectType), Protected) + lazy val Object_finalize: TermSymbol = enterMethod(ObjectClass, nme.finalize_, MethodType(Nil, UnitType), Protected) + lazy val Object_notify: TermSymbol = enterMethod(ObjectClass, nme.notify_, MethodType(Nil, UnitType), Final) + lazy val Object_notifyAll: TermSymbol = enterMethod(ObjectClass, nme.notifyAll_, MethodType(Nil, UnitType), Final) + lazy val Object_wait: TermSymbol = enterMethod(ObjectClass, nme.wait_, MethodType(Nil, UnitType), Final) + lazy val Object_waitL: TermSymbol = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: Nil, UnitType), Final) + lazy val Object_waitLI: TermSymbol = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: IntType :: Nil, UnitType), Final) + + def ObjectMethods: List[Symbols.TermSymbol] = List(Object_eq, Object_ne, Object_synchronized, Object_clone, Object_finalize, Object_notify, Object_notifyAll, Object_wait, Object_waitL, Object_waitLI) - lazy val AnyKindClass = { + lazy val AnyKindClass: ClassSymbol = { val cls = ctx.newCompleteClassSymbol(ScalaPackageClass, tpnme.AnyKind, AbstractFinal | Permanent, Nil) if (ctx.settings.YkindPolymorphism.value) { // Enable kind-polymorphism by exposing scala.AnyKind @@ -319,60 +320,60 @@ class Definitions { } cls } - def AnyKindType = AnyKindClass.typeRef + def AnyKindType: TypeRef = AnyKindClass.typeRef /** Marker method to indicate an argument to a call-by-name parameter. * Created by byNameClosures and elimByName, eliminated by Erasure, */ - lazy val cbnArg = enterPolyMethod(OpsPackageClass, nme.cbnArg, 1, + lazy val cbnArg: TermSymbol = enterPolyMethod(OpsPackageClass, nme.cbnArg, 1, pt => MethodType(List(FunctionOf(Nil, pt.paramRefs(0))), pt.paramRefs(0))) /** Method representing a throw */ - lazy val throwMethod = enterMethod(OpsPackageClass, nme.THROWkw, + lazy val throwMethod: TermSymbol = enterMethod(OpsPackageClass, nme.THROWkw, MethodType(List(ThrowableType), NothingType)) lazy val NothingClass: ClassSymbol = enterCompleteClassSymbol( ScalaPackageClass, tpnme.Nothing, AbstractFinal, List(AnyClass.typeRef)) - def NothingType = NothingClass.typeRef - lazy val RuntimeNothingModuleRef = ctx.requiredModuleRef("scala.runtime.Nothing") + def NothingType: TypeRef = NothingClass.typeRef + lazy val RuntimeNothingModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.Nothing") lazy val NullClass: ClassSymbol = enterCompleteClassSymbol( ScalaPackageClass, tpnme.Null, AbstractFinal, List(ObjectClass.typeRef)) - def NullType = NullClass.typeRef - lazy val RuntimeNullModuleRef = ctx.requiredModuleRef("scala.runtime.Null") - - lazy val ScalaPredefModuleRef = ctx.requiredModuleRef("scala.Predef") - def ScalaPredefModule(implicit ctx: Context) = ScalaPredefModuleRef.symbol - - lazy val Predef_ConformsR = ScalaPredefModule.requiredClass("<:<").typeRef - def Predef_Conforms(implicit ctx: Context) = Predef_ConformsR.symbol - lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef(nme.conforms_) - def Predef_conforms(implicit ctx: Context) = Predef_conformsR.symbol - lazy val Predef_classOfR = ScalaPredefModule.requiredMethodRef(nme.classOf) - def Predef_classOf(implicit ctx: Context) = Predef_classOfR.symbol - lazy val Predef_undefinedR = ScalaPredefModule.requiredMethodRef(nme.???) - def Predef_undefined(implicit ctx: Context) = Predef_undefinedR.symbol - - lazy val ScalaRuntimeModuleRef = ctx.requiredModuleRef("scala.runtime.ScalaRunTime") - def ScalaRuntimeModule(implicit ctx: Context) = ScalaRuntimeModuleRef.symbol - def ScalaRuntimeClass(implicit ctx: Context) = ScalaRuntimeModule.moduleClass.asClass - - def runtimeMethodRef(name: PreName) = ScalaRuntimeModule.requiredMethodRef(name) - def ScalaRuntime_dropR(implicit ctx: Context) = runtimeMethodRef(nme.drop) - def ScalaRuntime_drop(implicit ctx: Context) = ScalaRuntime_dropR.symbol - - lazy val BoxesRunTimeModuleRef = ctx.requiredModuleRef("scala.runtime.BoxesRunTime") - def BoxesRunTimeModule(implicit ctx: Context) = BoxesRunTimeModuleRef.symbol - def BoxesRunTimeClass(implicit ctx: Context) = BoxesRunTimeModule.moduleClass.asClass - lazy val ScalaStaticsModuleRef = ctx.requiredModuleRef("scala.runtime.Statics") - def ScalaStaticsModule(implicit ctx: Context) = ScalaStaticsModuleRef.symbol - def ScalaStaticsClass(implicit ctx: Context) = ScalaStaticsModule.moduleClass.asClass - - def staticsMethodRef(name: PreName) = ScalaStaticsModule.requiredMethodRef(name) - def staticsMethod(name: PreName) = ScalaStaticsModule.requiredMethod(name) + def NullType: TypeRef = NullClass.typeRef + lazy val RuntimeNullModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.Null") + + lazy val ScalaPredefModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.Predef") + def ScalaPredefModule(implicit ctx: Context): Symbol = ScalaPredefModuleRef.symbol + + lazy val Predef_ConformsR: TypeRef = ScalaPredefModule.requiredClass("<:<").typeRef + def Predef_Conforms(implicit ctx: Context): Symbol = Predef_ConformsR.symbol + lazy val Predef_conformsR: Types.TermRef = ScalaPredefModule.requiredMethodRef(nme.conforms_) + def Predef_conforms(implicit ctx: Context): Symbol = Predef_conformsR.symbol + lazy val Predef_classOfR: Types.TermRef = ScalaPredefModule.requiredMethodRef(nme.classOf) + def Predef_classOf(implicit ctx: Context): Symbol = Predef_classOfR.symbol + lazy val Predef_undefinedR: Types.TermRef = ScalaPredefModule.requiredMethodRef(nme.???) + def Predef_undefined(implicit ctx: Context): Symbol = Predef_undefinedR.symbol + + lazy val ScalaRuntimeModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.ScalaRunTime") + def ScalaRuntimeModule(implicit ctx: Context): Symbol = ScalaRuntimeModuleRef.symbol + def ScalaRuntimeClass(implicit ctx: Context): ClassSymbol = ScalaRuntimeModule.moduleClass.asClass + + def runtimeMethodRef(name: PreName): Types.TermRef = ScalaRuntimeModule.requiredMethodRef(name) + def ScalaRuntime_dropR(implicit ctx: Context): Types.TermRef = runtimeMethodRef(nme.drop) + def ScalaRuntime_drop(implicit ctx: Context): Symbol = ScalaRuntime_dropR.symbol + + lazy val BoxesRunTimeModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.BoxesRunTime") + def BoxesRunTimeModule(implicit ctx: Context): Symbol = BoxesRunTimeModuleRef.symbol + def BoxesRunTimeClass(implicit ctx: Context): ClassSymbol = BoxesRunTimeModule.moduleClass.asClass + lazy val ScalaStaticsModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.Statics") + def ScalaStaticsModule(implicit ctx: Context): Symbol = ScalaStaticsModuleRef.symbol + def ScalaStaticsClass(implicit ctx: Context): ClassSymbol = ScalaStaticsModule.moduleClass.asClass + + def staticsMethodRef(name: PreName): Types.TermRef = ScalaStaticsModule.requiredMethodRef(name) + def staticsMethod(name: PreName): TermSymbol = ScalaStaticsModule.requiredMethod(name) // Dotty deviation: we cannot use a lazy val here because lazy vals in dotty // will return "null" when called recursively, see #1856. - def DottyPredefModuleRef = { + def DottyPredefModuleRef: Types.TermRef = { if (myDottyPredefModuleRef == null) { myDottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef") assert(myDottyPredefModuleRef != null) @@ -381,29 +382,29 @@ class Definitions { } private[this] var myDottyPredefModuleRef: TermRef = _ - def DottyPredefModule(implicit ctx: Context) = DottyPredefModuleRef.symbol + def DottyPredefModule(implicit ctx: Context): Symbol = DottyPredefModuleRef.symbol - lazy val Predef_ImplicitConverterR = DottyPredefModule.requiredClass("ImplicitConverter").typeRef - def Predef_ImplicitConverter(implicit ctx: Context) = Predef_ImplicitConverterR.symbol + lazy val Predef_ImplicitConverterR: TypeRef = DottyPredefModule.requiredClass("ImplicitConverter").typeRef + def Predef_ImplicitConverter(implicit ctx: Context): Symbol = Predef_ImplicitConverterR.symbol - lazy val DottyArraysModuleRef = ctx.requiredModuleRef("dotty.runtime.Arrays") - def DottyArraysModule(implicit ctx: Context) = DottyArraysModuleRef.symbol - def newGenericArrayMethod(implicit ctx: Context) = DottyArraysModule.requiredMethod("newGenericArray") - def newArrayMethod(implicit ctx: Context) = DottyArraysModule.requiredMethod("newArray") + lazy val DottyArraysModuleRef: Types.TermRef = ctx.requiredModuleRef("dotty.runtime.Arrays") + def DottyArraysModule(implicit ctx: Context): Symbol = DottyArraysModuleRef.symbol + def newGenericArrayMethod(implicit ctx: Context): TermSymbol = DottyArraysModule.requiredMethod("newGenericArray") + def newArrayMethod(implicit ctx: Context): TermSymbol = DottyArraysModule.requiredMethod("newArray") // TODO: Remove once we drop support for 2.12 standard library private[this] lazy val isNewCollections = ctx.base.staticRef("scala.collection.IterableOnce".toTypeName).exists - def getWrapVarargsArrayModule = if (isNewCollections) ScalaRuntimeModule else ScalaPredefModule + def getWrapVarargsArrayModule: Symbol = if (isNewCollections) ScalaRuntimeModule else ScalaPredefModule // The set of all wrap{X, Ref}Array methods, where X is a value type - val WrapArrayMethods = new PerRun[collection.Set[Symbol]]({ implicit ctx => + val WrapArrayMethods: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]]({ implicit ctx => val methodNames = ScalaValueTypes.map(ast.tpd.wrapArrayMethodName) + nme.wrapRefArray methodNames.map(getWrapVarargsArrayModule.requiredMethodRef(_).symbol) }) - lazy val NilModuleRef = ctx.requiredModuleRef("scala.collection.immutable.Nil") - def NilModule(implicit ctx: Context) = NilModuleRef.symbol + lazy val NilModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.collection.immutable.Nil") + def NilModule(implicit ctx: Context): Symbol = NilModuleRef.symbol lazy val SingletonClass: ClassSymbol = // needed as a synthetic class because Scala 2.x refers to it in classfiles @@ -416,415 +417,415 @@ class Definitions { lazy val SeqType: TypeRef = if (isNewCollections) ctx.requiredClassRef("scala.collection.immutable.Seq") else ctx.requiredClassRef("scala.collection.Seq") - def SeqClass(implicit ctx: Context) = SeqType.symbol.asClass - lazy val Seq_applyR = SeqClass.requiredMethodRef(nme.apply) - def Seq_apply(implicit ctx: Context) = Seq_applyR.symbol - lazy val Seq_headR = SeqClass.requiredMethodRef(nme.head) - def Seq_head(implicit ctx: Context) = Seq_headR.symbol - lazy val Seq_dropR = SeqClass.requiredMethodRef(nme.drop) - def Seq_drop(implicit ctx: Context) = Seq_dropR.symbol - lazy val Seq_lengthCompareR = SeqClass.requiredMethodRef(nme.lengthCompare) - def Seq_lengthCompare(implicit ctx: Context) = Seq_lengthCompareR.symbol - lazy val Seq_lengthR = SeqClass.requiredMethodRef(nme.length) - def Seq_length(implicit ctx: Context) = Seq_lengthR.symbol - lazy val Seq_toSeqR = SeqClass.requiredMethodRef(nme.toSeq) - def Seq_toSeq(implicit ctx: Context) = Seq_toSeqR.symbol + def SeqClass(implicit ctx: Context): ClassSymbol = SeqType.symbol.asClass + lazy val Seq_applyR: Types.TermRef = SeqClass.requiredMethodRef(nme.apply) + def Seq_apply(implicit ctx: Context): Symbol = Seq_applyR.symbol + lazy val Seq_headR: Types.TermRef = SeqClass.requiredMethodRef(nme.head) + def Seq_head(implicit ctx: Context): Symbol = Seq_headR.symbol + lazy val Seq_dropR: Types.TermRef = SeqClass.requiredMethodRef(nme.drop) + def Seq_drop(implicit ctx: Context): Symbol = Seq_dropR.symbol + lazy val Seq_lengthCompareR: Types.TermRef = SeqClass.requiredMethodRef(nme.lengthCompare) + def Seq_lengthCompare(implicit ctx: Context): Symbol = Seq_lengthCompareR.symbol + lazy val Seq_lengthR: Types.TermRef = SeqClass.requiredMethodRef(nme.length) + def Seq_length(implicit ctx: Context): Symbol = Seq_lengthR.symbol + lazy val Seq_toSeqR: Types.TermRef = SeqClass.requiredMethodRef(nme.toSeq) + def Seq_toSeq(implicit ctx: Context): Symbol = Seq_toSeqR.symbol lazy val ArrayType: TypeRef = ctx.requiredClassRef("scala.Array") - def ArrayClass(implicit ctx: Context) = ArrayType.symbol.asClass - lazy val Array_applyR = ArrayClass.requiredMethodRef(nme.apply) - def Array_apply(implicit ctx: Context) = Array_applyR.symbol - lazy val Array_updateR = ArrayClass.requiredMethodRef(nme.update) - def Array_update(implicit ctx: Context) = Array_updateR.symbol - lazy val Array_lengthR = ArrayClass.requiredMethodRef(nme.length) - def Array_length(implicit ctx: Context) = Array_lengthR.symbol - lazy val Array_cloneR = ArrayClass.requiredMethodRef(nme.clone_) - def Array_clone(implicit ctx: Context) = Array_cloneR.symbol - lazy val ArrayConstructorR = ArrayClass.requiredMethodRef(nme.CONSTRUCTOR) - def ArrayConstructor(implicit ctx: Context) = ArrayConstructorR.symbol - lazy val ArrayModuleType = ctx.requiredModuleRef("scala.Array") - def ArrayModule(implicit ctx: Context) = ArrayModuleType.symbol.moduleClass.asClass + def ArrayClass(implicit ctx: Context): ClassSymbol = ArrayType.symbol.asClass + lazy val Array_applyR: Types.TermRef = ArrayClass.requiredMethodRef(nme.apply) + def Array_apply(implicit ctx: Context): Symbol = Array_applyR.symbol + lazy val Array_updateR: Types.TermRef = ArrayClass.requiredMethodRef(nme.update) + def Array_update(implicit ctx: Context): Symbol = Array_updateR.symbol + lazy val Array_lengthR: Types.TermRef = ArrayClass.requiredMethodRef(nme.length) + def Array_length(implicit ctx: Context): Symbol = Array_lengthR.symbol + lazy val Array_cloneR: Types.TermRef = ArrayClass.requiredMethodRef(nme.clone_) + def Array_clone(implicit ctx: Context): Symbol = Array_cloneR.symbol + lazy val ArrayConstructorR: Types.TermRef = ArrayClass.requiredMethodRef(nme.CONSTRUCTOR) + def ArrayConstructor(implicit ctx: Context): Symbol = ArrayConstructorR.symbol + lazy val ArrayModuleType: Types.TermRef = ctx.requiredModuleRef("scala.Array") + def ArrayModule(implicit ctx: Context): ClassSymbol = ArrayModuleType.symbol.moduleClass.asClass lazy val UnitType: TypeRef = valueTypeRef("scala.Unit", BoxedUnitType, java.lang.Void.TYPE, UnitEnc, nme.specializedTypeNames.Void) - def UnitClass(implicit ctx: Context) = UnitType.symbol.asClass - def UnitModuleClass(implicit ctx: Context) = UnitType.symbol.asClass.linkedClass - lazy val BooleanType = valueTypeRef("scala.Boolean", BoxedBooleanType, java.lang.Boolean.TYPE, BooleanEnc, nme.specializedTypeNames.Boolean) - def BooleanClass(implicit ctx: Context) = BooleanType.symbol.asClass - lazy val Boolean_notR = BooleanClass.requiredMethodRef(nme.UNARY_!) - def Boolean_! = Boolean_notR.symbol - lazy val Boolean_andR = BooleanClass.requiredMethodRef(nme.ZAND) // ### harmonize required... calls - def Boolean_&& = Boolean_andR.symbol - lazy val Boolean_orR = BooleanClass.requiredMethodRef(nme.ZOR) - def Boolean_|| = Boolean_orR.symbol - lazy val Boolean_eqeqR = BooleanClass.info.member(nme.EQ).suchThat(_.info.firstParamTypes match { + def UnitClass(implicit ctx: Context): ClassSymbol = UnitType.symbol.asClass + def UnitModuleClass(implicit ctx: Context): Symbol = UnitType.symbol.asClass.linkedClass + lazy val BooleanType: TypeRef = valueTypeRef("scala.Boolean", BoxedBooleanType, java.lang.Boolean.TYPE, BooleanEnc, nme.specializedTypeNames.Boolean) + def BooleanClass(implicit ctx: Context): ClassSymbol = BooleanType.symbol.asClass + lazy val Boolean_notR: Types.TermRef = BooleanClass.requiredMethodRef(nme.UNARY_!) + def Boolean_! : Symbol = Boolean_notR.symbol + lazy val Boolean_andR: Types.TermRef = BooleanClass.requiredMethodRef(nme.ZAND) // ### harmonize required... calls + def Boolean_&& : Symbol = Boolean_andR.symbol + lazy val Boolean_orR: Types.TermRef = BooleanClass.requiredMethodRef(nme.ZOR) + def Boolean_|| : Symbol = Boolean_orR.symbol + lazy val Boolean_eqeqR: SingleDenotation = BooleanClass.info.member(nme.EQ).suchThat(_.info.firstParamTypes match { case List(pt) => (pt isRef BooleanClass) case _ => false }) - def Boolean_== = Boolean_eqeqR.symbol - lazy val Boolean_neqeqR = BooleanClass.info.member(nme.NE).suchThat(_.info.firstParamTypes match { + def Boolean_== : Symbol = Boolean_eqeqR.symbol + lazy val Boolean_neqeqR: SingleDenotation = BooleanClass.info.member(nme.NE).suchThat(_.info.firstParamTypes match { case List(pt) => (pt isRef BooleanClass) case _ => false }) - def Boolean_!= = Boolean_neqeqR.symbol + def Boolean_!= : Symbol = Boolean_neqeqR.symbol lazy val ByteType: TypeRef = valueTypeRef("scala.Byte", BoxedByteType, java.lang.Byte.TYPE, ByteEnc, nme.specializedTypeNames.Byte) - def ByteClass(implicit ctx: Context) = ByteType.symbol.asClass + def ByteClass(implicit ctx: Context): ClassSymbol = ByteType.symbol.asClass lazy val ShortType: TypeRef = valueTypeRef("scala.Short", BoxedShortType, java.lang.Short.TYPE, ShortEnc, nme.specializedTypeNames.Short) - def ShortClass(implicit ctx: Context) = ShortType.symbol.asClass + def ShortClass(implicit ctx: Context): ClassSymbol = ShortType.symbol.asClass lazy val CharType: TypeRef = valueTypeRef("scala.Char", BoxedCharType, java.lang.Character.TYPE, CharEnc, nme.specializedTypeNames.Char) - def CharClass(implicit ctx: Context) = CharType.symbol.asClass + def CharClass(implicit ctx: Context): ClassSymbol = CharType.symbol.asClass lazy val IntType: TypeRef = valueTypeRef("scala.Int", BoxedIntType, java.lang.Integer.TYPE, IntEnc, nme.specializedTypeNames.Int) - def IntClass(implicit ctx: Context) = IntType.symbol.asClass - lazy val Int_minusR = IntClass.requiredMethodRef(nme.MINUS, List(IntType)) - def Int_- = Int_minusR.symbol - lazy val Int_plusR = IntClass.requiredMethodRef(nme.PLUS, List(IntType)) - def Int_+ = Int_plusR.symbol - lazy val Int_divR = IntClass.requiredMethodRef(nme.DIV, List(IntType)) - def Int_/ = Int_divR.symbol - lazy val Int_mulR = IntClass.requiredMethodRef(nme.MUL, List(IntType)) - def Int_* = Int_mulR.symbol - lazy val Int_eqR = IntClass.requiredMethodRef(nme.EQ, List(IntType)) - def Int_== = Int_eqR.symbol - lazy val Int_geR = IntClass.requiredMethodRef(nme.GE, List(IntType)) - def Int_>= = Int_geR.symbol - lazy val Int_leR = IntClass.requiredMethodRef(nme.LE, List(IntType)) - def Int_<= = Int_leR.symbol + def IntClass(implicit ctx: Context): ClassSymbol = IntType.symbol.asClass + lazy val Int_minusR: Types.TermRef = IntClass.requiredMethodRef(nme.MINUS, List(IntType)) + def Int_- : Symbol = Int_minusR.symbol + lazy val Int_plusR: Types.TermRef = IntClass.requiredMethodRef(nme.PLUS, List(IntType)) + def Int_+ : Symbol = Int_plusR.symbol + lazy val Int_divR: Types.TermRef = IntClass.requiredMethodRef(nme.DIV, List(IntType)) + def Int_/ : Symbol = Int_divR.symbol + lazy val Int_mulR: Types.TermRef = IntClass.requiredMethodRef(nme.MUL, List(IntType)) + def Int_* : Symbol = Int_mulR.symbol + lazy val Int_eqR: Types.TermRef = IntClass.requiredMethodRef(nme.EQ, List(IntType)) + def Int_== : Symbol = Int_eqR.symbol + lazy val Int_geR: Types.TermRef = IntClass.requiredMethodRef(nme.GE, List(IntType)) + def Int_>= : Symbol = Int_geR.symbol + lazy val Int_leR: Types.TermRef = IntClass.requiredMethodRef(nme.LE, List(IntType)) + def Int_<= : Symbol = Int_leR.symbol lazy val LongType: TypeRef = valueTypeRef("scala.Long", BoxedLongType, java.lang.Long.TYPE, LongEnc, nme.specializedTypeNames.Long) - def LongClass(implicit ctx: Context) = LongType.symbol.asClass - lazy val Long_XOR_Long = LongType.member(nme.XOR).requiredSymbol( + def LongClass(implicit ctx: Context): ClassSymbol = LongType.symbol.asClass + lazy val Long_XOR_Long: Symbol = LongType.member(nme.XOR).requiredSymbol( x => (x is Method) && (x.info.firstParamTypes.head isRef defn.LongClass) ) - lazy val Long_LSR_Int = LongType.member(nme.LSR).requiredSymbol( + lazy val Long_LSR_Int: Symbol = LongType.member(nme.LSR).requiredSymbol( x => (x is Method) && (x.info.firstParamTypes.head isRef defn.IntClass) ) - lazy val Long_plusR = LongClass.requiredMethodRef(nme.PLUS, List(LongType)) - def Long_+ = Long_plusR.symbol - lazy val Long_mulR = LongClass.requiredMethodRef(nme.MUL, List(LongType)) - def Long_* = Long_mulR.symbol - lazy val Long_divR = LongClass.requiredMethodRef(nme.DIV, List(LongType)) - def Long_/ = Long_divR.symbol + lazy val Long_plusR: Types.TermRef = LongClass.requiredMethodRef(nme.PLUS, List(LongType)) + def Long_+ : Symbol = Long_plusR.symbol + lazy val Long_mulR: Types.TermRef = LongClass.requiredMethodRef(nme.MUL, List(LongType)) + def Long_* : Symbol = Long_mulR.symbol + lazy val Long_divR: Types.TermRef = LongClass.requiredMethodRef(nme.DIV, List(LongType)) + def Long_/ : Symbol = Long_divR.symbol lazy val FloatType: TypeRef = valueTypeRef("scala.Float", BoxedFloatType, java.lang.Float.TYPE, FloatEnc, nme.specializedTypeNames.Float) - def FloatClass(implicit ctx: Context) = FloatType.symbol.asClass + def FloatClass(implicit ctx: Context): ClassSymbol = FloatType.symbol.asClass lazy val DoubleType: TypeRef = valueTypeRef("scala.Double", BoxedDoubleType, java.lang.Double.TYPE, DoubleEnc, nme.specializedTypeNames.Double) - def DoubleClass(implicit ctx: Context) = DoubleType.symbol.asClass + def DoubleClass(implicit ctx: Context): ClassSymbol = DoubleType.symbol.asClass lazy val BoxedUnitType: TypeRef = ctx.requiredClassRef("scala.runtime.BoxedUnit") - def BoxedUnitClass(implicit ctx: Context) = BoxedUnitType.symbol.asClass + def BoxedUnitClass(implicit ctx: Context): ClassSymbol = BoxedUnitType.symbol.asClass - def BoxedUnit_UNIT(implicit ctx: Context) = BoxedUnitClass.linkedClass.requiredValue("UNIT") + def BoxedUnit_UNIT(implicit ctx: Context): TermSymbol = BoxedUnitClass.linkedClass.requiredValue("UNIT") lazy val BoxedBooleanType: TypeRef = ctx.requiredClassRef("java.lang.Boolean") - def BoxedBooleanClass(implicit ctx: Context) = BoxedBooleanType.symbol.asClass + def BoxedBooleanClass(implicit ctx: Context): ClassSymbol = BoxedBooleanType.symbol.asClass lazy val BoxedByteType: TypeRef = ctx.requiredClassRef("java.lang.Byte") - def BoxedByteClass(implicit ctx: Context) = BoxedByteType.symbol.asClass + def BoxedByteClass(implicit ctx: Context): ClassSymbol = BoxedByteType.symbol.asClass lazy val BoxedShortType: TypeRef = ctx.requiredClassRef("java.lang.Short") - def BoxedShortClass(implicit ctx: Context) = BoxedShortType.symbol.asClass + def BoxedShortClass(implicit ctx: Context): ClassSymbol = BoxedShortType.symbol.asClass lazy val BoxedCharType: TypeRef = ctx.requiredClassRef("java.lang.Character") - def BoxedCharClass(implicit ctx: Context) = BoxedCharType.symbol.asClass + def BoxedCharClass(implicit ctx: Context): ClassSymbol = BoxedCharType.symbol.asClass lazy val BoxedIntType: TypeRef = ctx.requiredClassRef("java.lang.Integer") - def BoxedIntClass(implicit ctx: Context) = BoxedIntType.symbol.asClass + def BoxedIntClass(implicit ctx: Context): ClassSymbol = BoxedIntType.symbol.asClass lazy val BoxedLongType: TypeRef = ctx.requiredClassRef("java.lang.Long") - def BoxedLongClass(implicit ctx: Context) = BoxedLongType.symbol.asClass + def BoxedLongClass(implicit ctx: Context): ClassSymbol = BoxedLongType.symbol.asClass lazy val BoxedFloatType: TypeRef = ctx.requiredClassRef("java.lang.Float") - def BoxedFloatClass(implicit ctx: Context) = BoxedFloatType.symbol.asClass + def BoxedFloatClass(implicit ctx: Context): ClassSymbol = BoxedFloatType.symbol.asClass lazy val BoxedDoubleType: TypeRef = ctx.requiredClassRef("java.lang.Double") - def BoxedDoubleClass(implicit ctx: Context) = BoxedDoubleType.symbol.asClass + def BoxedDoubleClass(implicit ctx: Context): ClassSymbol = BoxedDoubleType.symbol.asClass - lazy val BoxedBooleanModule = ctx.requiredModule("java.lang.Boolean") - lazy val BoxedByteModule = ctx.requiredModule("java.lang.Byte") - lazy val BoxedShortModule = ctx.requiredModule("java.lang.Short") - lazy val BoxedCharModule = ctx.requiredModule("java.lang.Character") - lazy val BoxedIntModule = ctx.requiredModule("java.lang.Integer") - lazy val BoxedLongModule = ctx.requiredModule("java.lang.Long") - lazy val BoxedFloatModule = ctx.requiredModule("java.lang.Float") - lazy val BoxedDoubleModule = ctx.requiredModule("java.lang.Double") - lazy val BoxedUnitModule = ctx.requiredModule("java.lang.Void") + lazy val BoxedBooleanModule: TermSymbol = ctx.requiredModule("java.lang.Boolean") + lazy val BoxedByteModule: TermSymbol = ctx.requiredModule("java.lang.Byte") + lazy val BoxedShortModule: TermSymbol = ctx.requiredModule("java.lang.Short") + lazy val BoxedCharModule: TermSymbol = ctx.requiredModule("java.lang.Character") + lazy val BoxedIntModule: TermSymbol = ctx.requiredModule("java.lang.Integer") + lazy val BoxedLongModule: TermSymbol = ctx.requiredModule("java.lang.Long") + lazy val BoxedFloatModule: TermSymbol = ctx.requiredModule("java.lang.Float") + lazy val BoxedDoubleModule: TermSymbol = ctx.requiredModule("java.lang.Double") + lazy val BoxedUnitModule: TermSymbol = ctx.requiredModule("java.lang.Void") - lazy val ByNameParamClass2x = enterSpecialPolyClass(tpnme.BYNAME_PARAM_CLASS, Covariant, Seq(AnyType)) - lazy val EqualsPatternClass = enterSpecialPolyClass(tpnme.EQUALS_PATTERN, EmptyFlags, Seq(AnyType)) + lazy val ByNameParamClass2x: ClassSymbol = enterSpecialPolyClass(tpnme.BYNAME_PARAM_CLASS, Covariant, Seq(AnyType)) + lazy val EqualsPatternClass: ClassSymbol = enterSpecialPolyClass(tpnme.EQUALS_PATTERN, EmptyFlags, Seq(AnyType)) - lazy val RepeatedParamClass = enterSpecialPolyClass(tpnme.REPEATED_PARAM_CLASS, Covariant, Seq(ObjectType, SeqType)) + lazy val RepeatedParamClass: ClassSymbol = enterSpecialPolyClass(tpnme.REPEATED_PARAM_CLASS, Covariant, Seq(ObjectType, SeqType)) // fundamental classes - lazy val StringClass = ctx.requiredClass("java.lang.String") + lazy val StringClass: ClassSymbol = ctx.requiredClass("java.lang.String") def StringType: Type = StringClass.typeRef - lazy val StringModule = StringClass.linkedClass + lazy val StringModule: Symbol = StringClass.linkedClass - lazy val String_+ = enterMethod(StringClass, nme.raw.PLUS, methOfAny(StringType), Final) - lazy val String_valueOf_Object = StringModule.info.member(nme.valueOf).suchThat(_.info.firstParamTypes match { + lazy val String_+ : TermSymbol = enterMethod(StringClass, nme.raw.PLUS, methOfAny(StringType), Final) + lazy val String_valueOf_Object: Symbol = StringModule.info.member(nme.valueOf).suchThat(_.info.firstParamTypes match { case List(pt) => (pt isRef AnyClass) || (pt isRef ObjectClass) case _ => false }).symbol - lazy val JavaCloneableClass = ctx.requiredClass("java.lang.Cloneable") - lazy val NullPointerExceptionClass = ctx.requiredClass("java.lang.NullPointerException") - lazy val IndexOutOfBoundsException = ctx.requiredClass("java.lang.IndexOutOfBoundsException") - lazy val ClassClass = ctx.requiredClass("java.lang.Class") - lazy val BoxedNumberClass = ctx.requiredClass("java.lang.Number") - lazy val ClassCastExceptionClass = ctx.requiredClass("java.lang.ClassCastException") - lazy val ArithmeticExceptionClass = ctx.requiredClass("java.lang.ArithmeticException") - lazy val ArithmeticExceptionClass_stringConstructor = ArithmeticExceptionClass.info.member(nme.CONSTRUCTOR).suchThat(_.info.firstParamTypes match { + lazy val JavaCloneableClass: ClassSymbol = ctx.requiredClass("java.lang.Cloneable") + lazy val NullPointerExceptionClass: ClassSymbol = ctx.requiredClass("java.lang.NullPointerException") + lazy val IndexOutOfBoundsException: ClassSymbol = ctx.requiredClass("java.lang.IndexOutOfBoundsException") + lazy val ClassClass: ClassSymbol = ctx.requiredClass("java.lang.Class") + lazy val BoxedNumberClass: ClassSymbol = ctx.requiredClass("java.lang.Number") + lazy val ClassCastExceptionClass: ClassSymbol = ctx.requiredClass("java.lang.ClassCastException") + lazy val ArithmeticExceptionClass: ClassSymbol = ctx.requiredClass("java.lang.ArithmeticException") + lazy val ArithmeticExceptionClass_stringConstructor: TermSymbol = ArithmeticExceptionClass.info.member(nme.CONSTRUCTOR).suchThat(_.info.firstParamTypes match { case List(pt) => (pt isRef StringClass) case _ => false }).symbol.asTerm - lazy val JavaSerializableClass = ctx.requiredClass("java.io.Serializable") - lazy val ComparableClass = ctx.requiredClass("java.lang.Comparable") + lazy val JavaSerializableClass: ClassSymbol = ctx.requiredClass("java.io.Serializable") + lazy val ComparableClass: ClassSymbol = ctx.requiredClass("java.lang.Comparable") - lazy val SystemClass = ctx.requiredClass("java.lang.System") - lazy val SystemModule = SystemClass.linkedClass + lazy val SystemClass: ClassSymbol = ctx.requiredClass("java.lang.System") + lazy val SystemModule: Symbol = SystemClass.linkedClass // in scalac modified to have Any as parent lazy val ThrowableType: TypeRef = ctx.requiredClassRef("java.lang.Throwable") - def ThrowableClass(implicit ctx: Context) = ThrowableType.symbol.asClass + def ThrowableClass(implicit ctx: Context): ClassSymbol = ThrowableType.symbol.asClass lazy val SerializableType: TypeRef = ctx.requiredClassRef("scala.Serializable") - def SerializableClass(implicit ctx: Context) = SerializableType.symbol.asClass + def SerializableClass(implicit ctx: Context): ClassSymbol = SerializableType.symbol.asClass lazy val StringBuilderType: TypeRef = ctx.requiredClassRef("scala.collection.mutable.StringBuilder") - def StringBuilderClass(implicit ctx: Context) = StringBuilderType.symbol.asClass + def StringBuilderClass(implicit ctx: Context): ClassSymbol = StringBuilderType.symbol.asClass lazy val MatchErrorType: TypeRef = ctx.requiredClassRef("scala.MatchError") - def MatchErrorClass(implicit ctx: Context) = MatchErrorType.symbol.asClass + def MatchErrorClass(implicit ctx: Context): ClassSymbol = MatchErrorType.symbol.asClass lazy val StringAddType: TypeRef = ctx.requiredClassRef("scala.runtime.StringAdd") - def StringAddClass(implicit ctx: Context) = StringAddType.symbol.asClass + def StringAddClass(implicit ctx: Context): ClassSymbol = StringAddType.symbol.asClass - lazy val StringAdd_plusR = StringAddClass.requiredMethodRef(nme.raw.PLUS) - def StringAdd_+(implicit ctx: Context) = StringAdd_plusR.symbol + lazy val StringAdd_plusR: Types.TermRef = StringAddClass.requiredMethodRef(nme.raw.PLUS) + def StringAdd_+(implicit ctx: Context): Symbol = StringAdd_plusR.symbol lazy val StringContextType: TypeRef = ctx.requiredClassRef("scala.StringContext") - def StringContextClass(implicit ctx: Context) = StringContextType.symbol.asClass - lazy val StringContextSR = StringContextClass.requiredMethodRef(nme.s) - def StringContextS(implicit ctx: Context) = StringContextSR.symbol - lazy val StringContextRawR = StringContextClass.requiredMethodRef(nme.raw_) - def StringContextRaw(implicit ctx: Context) = StringContextRawR.symbol - def StringContextModule(implicit ctx: Context) = StringContextClass.companionModule - lazy val StringContextModule_applyR = StringContextModule.requiredMethodRef(nme.apply) - def StringContextModule_apply(implicit ctx: Context) = StringContextModule_applyR.symbol + def StringContextClass(implicit ctx: Context): ClassSymbol = StringContextType.symbol.asClass + lazy val StringContextSR: Types.TermRef = StringContextClass.requiredMethodRef(nme.s) + def StringContextS(implicit ctx: Context): Symbol = StringContextSR.symbol + lazy val StringContextRawR: Types.TermRef = StringContextClass.requiredMethodRef(nme.raw_) + def StringContextRaw(implicit ctx: Context): Symbol = StringContextRawR.symbol + def StringContextModule(implicit ctx: Context): Symbol = StringContextClass.companionModule + lazy val StringContextModule_applyR: Types.TermRef = StringContextModule.requiredMethodRef(nme.apply) + def StringContextModule_apply(implicit ctx: Context): Symbol = StringContextModule_applyR.symbol lazy val PartialFunctionType: TypeRef = ctx.requiredClassRef("scala.PartialFunction") - def PartialFunctionClass(implicit ctx: Context) = PartialFunctionType.symbol.asClass - lazy val PartialFunction_isDefinedAtR = PartialFunctionClass.requiredMethodRef(nme.isDefinedAt) - def PartialFunction_isDefinedAt(implicit ctx: Context) = PartialFunction_isDefinedAtR.symbol - lazy val PartialFunction_applyOrElseR = PartialFunctionClass.requiredMethodRef(nme.applyOrElse) - def PartialFunction_applyOrElse(implicit ctx: Context) = PartialFunction_applyOrElseR.symbol + def PartialFunctionClass(implicit ctx: Context): ClassSymbol = PartialFunctionType.symbol.asClass + lazy val PartialFunction_isDefinedAtR: Types.TermRef = PartialFunctionClass.requiredMethodRef(nme.isDefinedAt) + def PartialFunction_isDefinedAt(implicit ctx: Context): Symbol = PartialFunction_isDefinedAtR.symbol + lazy val PartialFunction_applyOrElseR: Types.TermRef = PartialFunctionClass.requiredMethodRef(nme.applyOrElse) + def PartialFunction_applyOrElse(implicit ctx: Context): Symbol = PartialFunction_applyOrElseR.symbol lazy val AbstractPartialFunctionType: TypeRef = ctx.requiredClassRef("scala.runtime.AbstractPartialFunction") - def AbstractPartialFunctionClass(implicit ctx: Context) = AbstractPartialFunctionType.symbol.asClass + def AbstractPartialFunctionClass(implicit ctx: Context): ClassSymbol = AbstractPartialFunctionType.symbol.asClass lazy val FunctionXXLType: TypeRef = ctx.requiredClassRef("scala.FunctionXXL") - def FunctionXXLClass(implicit ctx: Context) = FunctionXXLType.symbol.asClass + def FunctionXXLClass(implicit ctx: Context): ClassSymbol = FunctionXXLType.symbol.asClass lazy val ScalaSymbolType: TypeRef = ctx.requiredClassRef("scala.Symbol") - def ScalaSymbolClass(implicit ctx: Context) = ScalaSymbolType.symbol.asClass - def ScalaSymbolModule(implicit ctx: Context) = ScalaSymbolClass.companionModule - lazy val ScalaSymbolModule_applyR = ScalaSymbolModule.requiredMethodRef(nme.apply, List(StringType)) - def ScalaSymbolModule_apply(implicit ctx: Context) = ScalaSymbolModule_applyR.symbol + def ScalaSymbolClass(implicit ctx: Context): ClassSymbol = ScalaSymbolType.symbol.asClass + def ScalaSymbolModule(implicit ctx: Context): Symbol = ScalaSymbolClass.companionModule + lazy val ScalaSymbolModule_applyR: Types.TermRef = ScalaSymbolModule.requiredMethodRef(nme.apply, List(StringType)) + def ScalaSymbolModule_apply(implicit ctx: Context): Symbol = ScalaSymbolModule_applyR.symbol lazy val DynamicType: TypeRef = ctx.requiredClassRef("scala.Dynamic") - def DynamicClass(implicit ctx: Context) = DynamicType.symbol.asClass + def DynamicClass(implicit ctx: Context): ClassSymbol = DynamicType.symbol.asClass lazy val OptionType: TypeRef = ctx.requiredClassRef("scala.Option") - def OptionClass(implicit ctx: Context) = OptionType.symbol.asClass + def OptionClass(implicit ctx: Context): ClassSymbol = OptionType.symbol.asClass lazy val SomeType: TypeRef = ctx.requiredClassRef("scala.Some") - def SomeClass(implicit ctx: Context) = SomeType.symbol.asClass + def SomeClass(implicit ctx: Context): ClassSymbol = SomeType.symbol.asClass lazy val NoneModuleRef: TermRef = ctx.requiredModuleRef("scala.None") - def NoneClass(implicit ctx: Context) = NoneModuleRef.symbol.moduleClass.asClass + def NoneClass(implicit ctx: Context): ClassSymbol = NoneModuleRef.symbol.moduleClass.asClass lazy val EnumType: TypeRef = ctx.requiredClassRef("scala.Enum") - def EnumClass(implicit ctx: Context) = EnumType.symbol.asClass + def EnumClass(implicit ctx: Context): ClassSymbol = EnumType.symbol.asClass lazy val EnumValuesType: TypeRef = ctx.requiredClassRef("scala.runtime.EnumValues") - def EnumValuesClass(implicit ctx: Context) = EnumValuesType.symbol.asClass + def EnumValuesClass(implicit ctx: Context): ClassSymbol = EnumValuesType.symbol.asClass lazy val ProductType: TypeRef = ctx.requiredClassRef("scala.Product") - def ProductClass(implicit ctx: Context) = ProductType.symbol.asClass - lazy val Product_canEqualR = ProductClass.requiredMethodRef(nme.canEqual_) - def Product_canEqual(implicit ctx: Context) = Product_canEqualR.symbol - lazy val Product_productArityR = ProductClass.requiredMethodRef(nme.productArity) - def Product_productArity(implicit ctx: Context) = Product_productArityR.symbol - lazy val Product_productElementR = ProductClass.requiredMethodRef(nme.productElement) - def Product_productElement(implicit ctx: Context) = Product_productElementR.symbol - lazy val Product_productPrefixR = ProductClass.requiredMethodRef(nme.productPrefix) - def Product_productPrefix(implicit ctx: Context) = Product_productPrefixR.symbol - lazy val LanguageModuleRef = ctx.requiredModule("scala.language") - def LanguageModuleClass(implicit ctx: Context) = LanguageModuleRef.moduleClass.asClass + def ProductClass(implicit ctx: Context): ClassSymbol = ProductType.symbol.asClass + lazy val Product_canEqualR: Types.TermRef = ProductClass.requiredMethodRef(nme.canEqual_) + def Product_canEqual(implicit ctx: Context): Symbol = Product_canEqualR.symbol + lazy val Product_productArityR: Types.TermRef = ProductClass.requiredMethodRef(nme.productArity) + def Product_productArity(implicit ctx: Context): Symbol = Product_productArityR.symbol + lazy val Product_productElementR: Types.TermRef = ProductClass.requiredMethodRef(nme.productElement) + def Product_productElement(implicit ctx: Context): Symbol = Product_productElementR.symbol + lazy val Product_productPrefixR: Types.TermRef = ProductClass.requiredMethodRef(nme.productPrefix) + def Product_productPrefix(implicit ctx: Context): Symbol = Product_productPrefixR.symbol + lazy val LanguageModuleRef: TermSymbol = ctx.requiredModule("scala.language") + def LanguageModuleClass(implicit ctx: Context): ClassSymbol = LanguageModuleRef.moduleClass.asClass lazy val NonLocalReturnControlType: TypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl") lazy val SelectableType: TypeRef = ctx.requiredClassRef("scala.Selectable") - lazy val ClassTagType = ctx.requiredClassRef("scala.reflect.ClassTag") - def ClassTagClass(implicit ctx: Context) = ClassTagType.symbol.asClass - def ClassTagModule(implicit ctx: Context) = ClassTagClass.companionModule + lazy val ClassTagType: TypeRef = ctx.requiredClassRef("scala.reflect.ClassTag") + def ClassTagClass(implicit ctx: Context): ClassSymbol = ClassTagType.symbol.asClass + def ClassTagModule(implicit ctx: Context): Symbol = ClassTagClass.companionModule - lazy val QuotedExprType = ctx.requiredClassRef("scala.quoted.Expr") - def QuotedExprClass(implicit ctx: Context) = QuotedExprType.symbol.asClass - def QuotedExprModule(implicit ctx: Context) = QuotedExprClass.companionModule - lazy val QuotedExpr_applyR = QuotedExprModule.requiredMethodRef(nme.apply) - def QuotedExpr_apply(implicit ctx: Context) = QuotedExpr_applyR.symbol - lazy val QuotedExpr_~ = QuotedExprClass.requiredMethod(nme.UNARY_~) + lazy val QuotedExprType: TypeRef = ctx.requiredClassRef("scala.quoted.Expr") + def QuotedExprClass(implicit ctx: Context): ClassSymbol = QuotedExprType.symbol.asClass + def QuotedExprModule(implicit ctx: Context): Symbol = QuotedExprClass.companionModule + lazy val QuotedExpr_applyR: Types.TermRef = QuotedExprModule.requiredMethodRef(nme.apply) + def QuotedExpr_apply(implicit ctx: Context): Symbol = QuotedExpr_applyR.symbol + lazy val QuotedExpr_~ : TermSymbol = QuotedExprClass.requiredMethod(nme.UNARY_~) - lazy val QuotedExprsModule = ctx.requiredModule("scala.quoted.Exprs") - def QuotedExprsClass(implicit ctx: Context) = QuotedExprsModule.asClass + lazy val QuotedExprsModule: TermSymbol = ctx.requiredModule("scala.quoted.Exprs") + def QuotedExprsClass(implicit ctx: Context): ClassSymbol = QuotedExprsModule.asClass - lazy val QuotedTypeType = ctx.requiredClassRef("scala.quoted.Type") - def QuotedTypeClass(implicit ctx: Context) = QuotedTypeType.symbol.asClass + lazy val QuotedTypeType: TypeRef = ctx.requiredClassRef("scala.quoted.Type") + def QuotedTypeClass(implicit ctx: Context): ClassSymbol = QuotedTypeType.symbol.asClass - lazy val QuotedType_spliceR = QuotedTypeClass.requiredType(tpnme.UNARY_~).typeRef - def QuotedType_~ = QuotedType_spliceR.symbol + lazy val QuotedType_spliceR: TypeRef = QuotedTypeClass.requiredType(tpnme.UNARY_~).typeRef + def QuotedType_~ : Symbol = QuotedType_spliceR.symbol - lazy val QuotedTypeModuleType = ctx.requiredModuleRef("scala.quoted.Type") - def QuotedTypeModule(implicit ctx: Context) = QuotedTypeModuleType.symbol - lazy val QuotedType_applyR = QuotedTypeModule.requiredMethodRef(nme.apply) - def QuotedType_apply(implicit ctx: Context) = QuotedType_applyR.symbol + lazy val QuotedTypeModuleType: Types.TermRef = ctx.requiredModuleRef("scala.quoted.Type") + def QuotedTypeModule(implicit ctx: Context): Symbol = QuotedTypeModuleType.symbol + lazy val QuotedType_applyR: Types.TermRef = QuotedTypeModule.requiredMethodRef(nme.apply) + def QuotedType_apply(implicit ctx: Context): Symbol = QuotedType_applyR.symbol - lazy val QuotedLiftableModule = ctx.requiredModule("scala.quoted.Liftable") - def QuotedLiftableModuleClass(implicit ctx: Context) = QuotedLiftableModule.asClass + lazy val QuotedLiftableModule: TermSymbol = ctx.requiredModule("scala.quoted.Liftable") + def QuotedLiftableModuleClass(implicit ctx: Context): ClassSymbol = QuotedLiftableModule.asClass - def QuotedLiftable_BooleanIsLiftable = QuotedLiftableModule.requiredMethodRef("BooleanIsLiftable") - def QuotedLiftable_ByteIsLiftable = QuotedLiftableModule.requiredMethodRef("ByteIsLiftable") - def QuotedLiftable_CharIsLiftable = QuotedLiftableModule.requiredMethodRef("CharIsLiftable") - def QuotedLiftable_ShortIsLiftable = QuotedLiftableModule.requiredMethodRef("ShortIsLiftable") - def QuotedLiftable_IntIsLiftable = QuotedLiftableModule.requiredMethodRef("IntIsLiftable") - def QuotedLiftable_LongIsLiftable = QuotedLiftableModule.requiredMethodRef("LongIsLiftable") - def QuotedLiftable_FloatIsLiftable = QuotedLiftableModule.requiredMethodRef("FloatIsLiftable") - def QuotedLiftable_DoubleIsLiftable = QuotedLiftableModule.requiredMethodRef("DoubleIsLiftable") - def QuotedLiftable_StringIsLiftable = QuotedLiftableModule.requiredMethodRef("StringIsLiftable") + def QuotedLiftable_BooleanIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("BooleanIsLiftable") + def QuotedLiftable_ByteIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("ByteIsLiftable") + def QuotedLiftable_CharIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("CharIsLiftable") + def QuotedLiftable_ShortIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("ShortIsLiftable") + def QuotedLiftable_IntIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("IntIsLiftable") + def QuotedLiftable_LongIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("LongIsLiftable") + def QuotedLiftable_FloatIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("FloatIsLiftable") + def QuotedLiftable_DoubleIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("DoubleIsLiftable") + def QuotedLiftable_StringIsLiftable: Types.TermRef = QuotedLiftableModule.requiredMethodRef("StringIsLiftable") - lazy val QuotedLiftableType = ctx.requiredClassRef("scala.quoted.Liftable") - def QuotedLiftableClass(implicit ctx: Context) = QuotedLiftableType.symbol.asClass + lazy val QuotedLiftableType: TypeRef = ctx.requiredClassRef("scala.quoted.Liftable") + def QuotedLiftableClass(implicit ctx: Context): ClassSymbol = QuotedLiftableType.symbol.asClass - def Unpickler_unpickleExpr = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleExpr") - def Unpickler_liftedExpr = ctx.requiredMethod("scala.runtime.quoted.Unpickler.liftedExpr") - def Unpickler_unpickleType = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleType") + def Unpickler_unpickleExpr: TermSymbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleExpr") + def Unpickler_liftedExpr: TermSymbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.liftedExpr") + def Unpickler_unpickleType: TermSymbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleType") - lazy val TastyTastyType = ctx.requiredClassRef("scala.tasty.Tasty") - def TastyTastyClass(implicit ctx: Context) = TastyTastyType.symbol.asClass + lazy val TastyTastyType: TypeRef = ctx.requiredClassRef("scala.tasty.Tasty") + def TastyTastyClass(implicit ctx: Context): ClassSymbol = TastyTastyType.symbol.asClass - lazy val TastyTastyModule = ctx.requiredModule("scala.tasty.Tasty") - lazy val TastyTasty_macroContext = TastyTastyModule.requiredMethod("macroContext") + lazy val TastyTastyModule: TermSymbol = ctx.requiredModule("scala.tasty.Tasty") + lazy val TastyTasty_macroContext: TermSymbol = TastyTastyModule.requiredMethod("macroContext") - lazy val EqType = ctx.requiredClassRef("scala.Eq") - def EqClass(implicit ctx: Context) = EqType.symbol.asClass - def EqModule(implicit ctx: Context) = EqClass.companionModule + lazy val EqType: TypeRef = ctx.requiredClassRef("scala.Eq") + def EqClass(implicit ctx: Context): ClassSymbol = EqType.symbol.asClass + def EqModule(implicit ctx: Context): Symbol = EqClass.companionModule - def Eq_eqAny(implicit ctx: Context) = EqModule.requiredMethod(nme.eqAny) + def Eq_eqAny(implicit ctx: Context): TermSymbol = EqModule.requiredMethod(nme.eqAny) - lazy val NotType = ctx.requiredClassRef("scala.implicits.Not") - def NotClass(implicit ctx: Context) = NotType.symbol.asClass - def NotModule(implicit ctx: Context) = NotClass.companionModule + lazy val NotType: TypeRef = ctx.requiredClassRef("scala.implicits.Not") + def NotClass(implicit ctx: Context): ClassSymbol = NotType.symbol.asClass + def NotModule(implicit ctx: Context): Symbol = NotClass.companionModule - def Not_value(implicit ctx: Context) = NotModule.requiredMethod(nme.value) + def Not_value(implicit ctx: Context): TermSymbol = NotModule.requiredMethod(nme.value) - lazy val XMLTopScopeModuleRef = ctx.requiredModuleRef("scala.xml.TopScope") + lazy val XMLTopScopeModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.xml.TopScope") - lazy val TupleTypeRef = ctx.requiredClassRef("scala.Tuple") - def TupleClass(implicit ctx: Context) = TupleTypeRef.symbol.asClass - lazy val NonEmptyTupleTypeRef = ctx.requiredClassRef("scala.NonEmptyTuple") - def NonEmptyTupleClass(implicit ctx: Context) = NonEmptyTupleTypeRef.symbol.asClass + lazy val TupleTypeRef: TypeRef = ctx.requiredClassRef("scala.Tuple") + def TupleClass(implicit ctx: Context): ClassSymbol = TupleTypeRef.symbol.asClass + lazy val NonEmptyTupleTypeRef: TypeRef = ctx.requiredClassRef("scala.NonEmptyTuple") + def NonEmptyTupleClass(implicit ctx: Context): ClassSymbol = NonEmptyTupleTypeRef.symbol.asClass - lazy val PairType = ctx.requiredClassRef("scala.*:") - def PairClass(implicit ctx: Context) = PairType.symbol.asClass - lazy val TupleXXLType = ctx.requiredClassRef("scala.TupleXXL") - def TupleXXLClass(implicit ctx: Context) = TupleXXLType.symbol.asClass - def TupleXXLModule(implicit ctx: Context) = TupleXXLClass.companionModule + lazy val PairType: TypeRef = ctx.requiredClassRef("scala.*:") + def PairClass(implicit ctx: Context): ClassSymbol = PairType.symbol.asClass + lazy val TupleXXLType: TypeRef = ctx.requiredClassRef("scala.TupleXXL") + def TupleXXLClass(implicit ctx: Context): ClassSymbol = TupleXXLType.symbol.asClass + def TupleXXLModule(implicit ctx: Context): Symbol = TupleXXLClass.companionModule - def TupleXXL_apply(implicit ctx: Context) = + def TupleXXL_apply(implicit ctx: Context): Symbol = TupleXXLModule.info.member(nme.apply).requiredSymbol(_.info.isVarArgsMethod) // Annotation base classes - lazy val AnnotationType = ctx.requiredClassRef("scala.annotation.Annotation") - def AnnotationClass(implicit ctx: Context) = AnnotationType.symbol.asClass - lazy val ClassfileAnnotationType = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation") - def ClassfileAnnotationClass(implicit ctx: Context) = ClassfileAnnotationType.symbol.asClass - lazy val StaticAnnotationType = ctx.requiredClassRef("scala.annotation.StaticAnnotation") - def StaticAnnotationClass(implicit ctx: Context) = StaticAnnotationType.symbol.asClass - lazy val RefiningAnnotationType = ctx.requiredClassRef("scala.annotation.RefiningAnnotation") - def RefiningAnnotationClass(implicit ctx: Context) = RefiningAnnotationType.symbol.asClass + lazy val AnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.Annotation") + def AnnotationClass(implicit ctx: Context): ClassSymbol = AnnotationType.symbol.asClass + lazy val ClassfileAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation") + def ClassfileAnnotationClass(implicit ctx: Context): ClassSymbol = ClassfileAnnotationType.symbol.asClass + lazy val StaticAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.StaticAnnotation") + def StaticAnnotationClass(implicit ctx: Context): ClassSymbol = StaticAnnotationType.symbol.asClass + lazy val RefiningAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.RefiningAnnotation") + def RefiningAnnotationClass(implicit ctx: Context): ClassSymbol = RefiningAnnotationType.symbol.asClass // Annotation classes - lazy val AliasAnnotType = ctx.requiredClassRef("scala.annotation.internal.Alias") - def AliasAnnot(implicit ctx: Context) = AliasAnnotType.symbol.asClass - lazy val AnnotationDefaultAnnotType = ctx.requiredClassRef("scala.annotation.internal.AnnotationDefault") - def AnnotationDefaultAnnot(implicit ctx: Context) = AnnotationDefaultAnnotType.symbol.asClass - lazy val BodyAnnotType = ctx.requiredClassRef("scala.annotation.internal.Body") - def BodyAnnot(implicit ctx: Context) = BodyAnnotType.symbol.asClass - lazy val ChildAnnotType = ctx.requiredClassRef("scala.annotation.internal.Child") - def ChildAnnot(implicit ctx: Context) = ChildAnnotType.symbol.asClass - lazy val CovariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.CovariantBetween") - def CovariantBetweenAnnot(implicit ctx: Context) = CovariantBetweenAnnotType.symbol.asClass - lazy val ContravariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.ContravariantBetween") - def ContravariantBetweenAnnot(implicit ctx: Context) = ContravariantBetweenAnnotType.symbol.asClass - lazy val DeprecatedAnnotType = ctx.requiredClassRef("scala.deprecated") - def DeprecatedAnnot(implicit ctx: Context) = DeprecatedAnnotType.symbol.asClass - lazy val ImplicitAmbiguousAnnotType = ctx.requiredClassRef("scala.annotation.implicitAmbiguous") - def ImplicitAmbiguousAnnot(implicit ctx: Context) = ImplicitAmbiguousAnnotType.symbol.asClass - lazy val ImplicitNotFoundAnnotType = ctx.requiredClassRef("scala.annotation.implicitNotFound") - def ImplicitNotFoundAnnot(implicit ctx: Context) = ImplicitNotFoundAnnotType.symbol.asClass - lazy val ForceInlineAnnotType = ctx.requiredClassRef("scala.forceInline") - def ForceInlineAnnot(implicit ctx: Context) = ForceInlineAnnotType.symbol.asClass - lazy val InlineParamAnnotType = ctx.requiredClassRef("scala.annotation.internal.InlineParam") - def InlineParamAnnot(implicit ctx: Context) = InlineParamAnnotType.symbol.asClass - lazy val InvariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.InvariantBetween") - def InvariantBetweenAnnot(implicit ctx: Context) = InvariantBetweenAnnotType.symbol.asClass - lazy val MigrationAnnotType = ctx.requiredClassRef("scala.annotation.migration") - def MigrationAnnot(implicit ctx: Context) = MigrationAnnotType.symbol.asClass - lazy val NativeAnnotType = ctx.requiredClassRef("scala.native") - def NativeAnnot(implicit ctx: Context) = NativeAnnotType.symbol.asClass - lazy val RepeatedAnnotType = ctx.requiredClassRef("scala.annotation.internal.Repeated") - def RepeatedAnnot(implicit ctx: Context) = RepeatedAnnotType.symbol.asClass - lazy val SourceFileAnnotType = ctx.requiredClassRef("scala.annotation.internal.SourceFile") - def SourceFileAnnot(implicit ctx: Context) = SourceFileAnnotType.symbol.asClass - lazy val ScalaSignatureAnnotType = ctx.requiredClassRef("scala.reflect.ScalaSignature") - def ScalaSignatureAnnot(implicit ctx: Context) = ScalaSignatureAnnotType.symbol.asClass - lazy val ScalaLongSignatureAnnotType = ctx.requiredClassRef("scala.reflect.ScalaLongSignature") - def ScalaLongSignatureAnnot(implicit ctx: Context) = ScalaLongSignatureAnnotType.symbol.asClass - lazy val ScalaStrictFPAnnotType = ctx.requiredClassRef("scala.annotation.strictfp") - def ScalaStrictFPAnnot(implicit ctx: Context) = ScalaStrictFPAnnotType.symbol.asClass - lazy val ScalaStaticAnnotType = ctx.requiredClassRef("scala.annotation.static") - def ScalaStaticAnnot(implicit ctx: Context) = ScalaStaticAnnotType.symbol.asClass - lazy val SerialVersionUIDAnnotType = ctx.requiredClassRef("scala.SerialVersionUID") - def SerialVersionUIDAnnot(implicit ctx: Context) = SerialVersionUIDAnnotType.symbol.asClass - lazy val TASTYSignatureAnnotType = ctx.requiredClassRef("scala.annotation.internal.TASTYSignature") - def TASTYSignatureAnnot(implicit ctx: Context) = TASTYSignatureAnnotType.symbol.asClass - lazy val TASTYLongSignatureAnnotType = ctx.requiredClassRef("scala.annotation.internal.TASTYLongSignature") - def TASTYLongSignatureAnnot(implicit ctx: Context) = TASTYLongSignatureAnnotType.symbol.asClass - lazy val TailrecAnnotType = ctx.requiredClassRef("scala.annotation.tailrec") - def TailrecAnnot(implicit ctx: Context) = TailrecAnnotType.symbol.asClass - lazy val SwitchAnnotType = ctx.requiredClassRef("scala.annotation.switch") - def SwitchAnnot(implicit ctx: Context) = SwitchAnnotType.symbol.asClass - lazy val ThrowsAnnotType = ctx.requiredClassRef("scala.throws") - def ThrowsAnnot(implicit ctx: Context) = ThrowsAnnotType.symbol.asClass - lazy val TransientAnnotType = ctx.requiredClassRef("scala.transient") - def TransientAnnot(implicit ctx: Context) = TransientAnnotType.symbol.asClass - lazy val UncheckedAnnotType = ctx.requiredClassRef("scala.unchecked") - def UncheckedAnnot(implicit ctx: Context) = UncheckedAnnotType.symbol.asClass - lazy val UncheckedStableAnnotType = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedStable") - def UncheckedStableAnnot(implicit ctx: Context) = UncheckedStableAnnotType.symbol.asClass - lazy val UncheckedVarianceAnnotType = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedVariance") - def UncheckedVarianceAnnot(implicit ctx: Context) = UncheckedVarianceAnnotType.symbol.asClass - lazy val VolatileAnnotType = ctx.requiredClassRef("scala.volatile") - def VolatileAnnot(implicit ctx: Context) = VolatileAnnotType.symbol.asClass - lazy val FieldMetaAnnotType = ctx.requiredClassRef("scala.annotation.meta.field") - def FieldMetaAnnot(implicit ctx: Context) = FieldMetaAnnotType.symbol.asClass - lazy val GetterMetaAnnotType = ctx.requiredClassRef("scala.annotation.meta.getter") - def GetterMetaAnnot(implicit ctx: Context) = GetterMetaAnnotType.symbol.asClass - lazy val SetterMetaAnnotType = ctx.requiredClassRef("scala.annotation.meta.setter") - def SetterMetaAnnot(implicit ctx: Context) = SetterMetaAnnotType.symbol.asClass - lazy val ShowAsInfixAnotType = ctx.requiredClassRef("scala.annotation.showAsInfix") - def ShowAsInfixAnnot(implicit ctx: Context) = ShowAsInfixAnotType.symbol.asClass + lazy val AliasAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Alias") + def AliasAnnot(implicit ctx: Context): ClassSymbol = AliasAnnotType.symbol.asClass + lazy val AnnotationDefaultAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.AnnotationDefault") + def AnnotationDefaultAnnot(implicit ctx: Context): ClassSymbol = AnnotationDefaultAnnotType.symbol.asClass + lazy val BodyAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Body") + def BodyAnnot(implicit ctx: Context): ClassSymbol = BodyAnnotType.symbol.asClass + lazy val ChildAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Child") + def ChildAnnot(implicit ctx: Context): ClassSymbol = ChildAnnotType.symbol.asClass + lazy val CovariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.CovariantBetween") + def CovariantBetweenAnnot(implicit ctx: Context): ClassSymbol = CovariantBetweenAnnotType.symbol.asClass + lazy val ContravariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.ContravariantBetween") + def ContravariantBetweenAnnot(implicit ctx: Context): ClassSymbol = ContravariantBetweenAnnotType.symbol.asClass + lazy val DeprecatedAnnotType: TypeRef = ctx.requiredClassRef("scala.deprecated") + def DeprecatedAnnot(implicit ctx: Context): ClassSymbol = DeprecatedAnnotType.symbol.asClass + lazy val ImplicitAmbiguousAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.implicitAmbiguous") + def ImplicitAmbiguousAnnot(implicit ctx: Context): ClassSymbol = ImplicitAmbiguousAnnotType.symbol.asClass + lazy val ImplicitNotFoundAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.implicitNotFound") + def ImplicitNotFoundAnnot(implicit ctx: Context): ClassSymbol = ImplicitNotFoundAnnotType.symbol.asClass + lazy val ForceInlineAnnotType: TypeRef = ctx.requiredClassRef("scala.forceInline") + def ForceInlineAnnot(implicit ctx: Context): ClassSymbol = ForceInlineAnnotType.symbol.asClass + lazy val InlineParamAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.InlineParam") + def InlineParamAnnot(implicit ctx: Context): ClassSymbol = InlineParamAnnotType.symbol.asClass + lazy val InvariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.InvariantBetween") + def InvariantBetweenAnnot(implicit ctx: Context): ClassSymbol = InvariantBetweenAnnotType.symbol.asClass + lazy val MigrationAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.migration") + def MigrationAnnot(implicit ctx: Context): ClassSymbol = MigrationAnnotType.symbol.asClass + lazy val NativeAnnotType: TypeRef = ctx.requiredClassRef("scala.native") + def NativeAnnot(implicit ctx: Context): ClassSymbol = NativeAnnotType.symbol.asClass + lazy val RepeatedAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Repeated") + def RepeatedAnnot(implicit ctx: Context): ClassSymbol = RepeatedAnnotType.symbol.asClass + lazy val SourceFileAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.SourceFile") + def SourceFileAnnot(implicit ctx: Context): ClassSymbol = SourceFileAnnotType.symbol.asClass + lazy val ScalaSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.reflect.ScalaSignature") + def ScalaSignatureAnnot(implicit ctx: Context): ClassSymbol = ScalaSignatureAnnotType.symbol.asClass + lazy val ScalaLongSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.reflect.ScalaLongSignature") + def ScalaLongSignatureAnnot(implicit ctx: Context): ClassSymbol = ScalaLongSignatureAnnotType.symbol.asClass + lazy val ScalaStrictFPAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.strictfp") + def ScalaStrictFPAnnot(implicit ctx: Context): ClassSymbol = ScalaStrictFPAnnotType.symbol.asClass + lazy val ScalaStaticAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.static") + def ScalaStaticAnnot(implicit ctx: Context): ClassSymbol = ScalaStaticAnnotType.symbol.asClass + lazy val SerialVersionUIDAnnotType: TypeRef = ctx.requiredClassRef("scala.SerialVersionUID") + def SerialVersionUIDAnnot(implicit ctx: Context): ClassSymbol = SerialVersionUIDAnnotType.symbol.asClass + lazy val TASTYSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.TASTYSignature") + def TASTYSignatureAnnot(implicit ctx: Context): ClassSymbol = TASTYSignatureAnnotType.symbol.asClass + lazy val TASTYLongSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.TASTYLongSignature") + def TASTYLongSignatureAnnot(implicit ctx: Context): ClassSymbol = TASTYLongSignatureAnnotType.symbol.asClass + lazy val TailrecAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.tailrec") + def TailrecAnnot(implicit ctx: Context): ClassSymbol = TailrecAnnotType.symbol.asClass + lazy val SwitchAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.switch") + def SwitchAnnot(implicit ctx: Context): ClassSymbol = SwitchAnnotType.symbol.asClass + lazy val ThrowsAnnotType: TypeRef = ctx.requiredClassRef("scala.throws") + def ThrowsAnnot(implicit ctx: Context): ClassSymbol = ThrowsAnnotType.symbol.asClass + lazy val TransientAnnotType: TypeRef = ctx.requiredClassRef("scala.transient") + def TransientAnnot(implicit ctx: Context): ClassSymbol = TransientAnnotType.symbol.asClass + lazy val UncheckedAnnotType: TypeRef = ctx.requiredClassRef("scala.unchecked") + def UncheckedAnnot(implicit ctx: Context): ClassSymbol = UncheckedAnnotType.symbol.asClass + lazy val UncheckedStableAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedStable") + def UncheckedStableAnnot(implicit ctx: Context): ClassSymbol = UncheckedStableAnnotType.symbol.asClass + lazy val UncheckedVarianceAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedVariance") + def UncheckedVarianceAnnot(implicit ctx: Context): ClassSymbol = UncheckedVarianceAnnotType.symbol.asClass + lazy val VolatileAnnotType: TypeRef = ctx.requiredClassRef("scala.volatile") + def VolatileAnnot(implicit ctx: Context): ClassSymbol = VolatileAnnotType.symbol.asClass + lazy val FieldMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.field") + def FieldMetaAnnot(implicit ctx: Context): ClassSymbol = FieldMetaAnnotType.symbol.asClass + lazy val GetterMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.getter") + def GetterMetaAnnot(implicit ctx: Context): ClassSymbol = GetterMetaAnnotType.symbol.asClass + lazy val SetterMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.setter") + def SetterMetaAnnot(implicit ctx: Context): ClassSymbol = SetterMetaAnnotType.symbol.asClass + lazy val ShowAsInfixAnotType: TypeRef = ctx.requiredClassRef("scala.annotation.showAsInfix") + def ShowAsInfixAnnot(implicit ctx: Context): ClassSymbol = ShowAsInfixAnotType.symbol.asClass // convenient one-parameter method types - def methOfAny(tp: Type) = MethodType(List(AnyType), tp) - def methOfAnyVal(tp: Type) = MethodType(List(AnyValType), tp) - def methOfAnyRef(tp: Type) = MethodType(List(ObjectType), tp) + def methOfAny(tp: Type): MethodType = MethodType(List(AnyType), tp) + def methOfAnyVal(tp: Type): MethodType = MethodType(List(AnyValType), tp) + def methOfAnyRef(tp: Type): MethodType = MethodType(List(ObjectType), tp) // Derived types - def RepeatedParamType = RepeatedParamClass.typeRef + def RepeatedParamType: TypeRef = RepeatedParamClass.typeRef - def ClassType(arg: Type)(implicit ctx: Context) = { + def ClassType(arg: Type)(implicit ctx: Context): Type = { val ctype = ClassClass.typeRef if (ctx.phase.erasedTypes) ctype else ctype.appliedTo(arg) } /** The enumeration type, goven a value of the enumeration */ - def EnumType(sym: Symbol)(implicit ctx: Context) = + def EnumType(sym: Symbol)(implicit ctx: Context): TypeRef = // given (in java): "class A { enum E { VAL1 } }" // - sym: the symbol of the actual enumeration value (VAL1) // - .owner: the ModuleClassSymbol of the enumeration (object E) @@ -832,9 +833,9 @@ class Definitions { sym.owner.linkedClass.typeRef object FunctionOf { - def apply(args: List[Type], resultType: Type, isImplicit: Boolean = false, isErased: Boolean = false)(implicit ctx: Context) = + def apply(args: List[Type], resultType: Type, isImplicit: Boolean = false, isErased: Boolean = false)(implicit ctx: Context): Type = FunctionType(args.length, isImplicit, isErased).appliedTo(args ::: resultType :: Nil) - def unapply(ft: Type)(implicit ctx: Context) = { + def unapply(ft: Type)(implicit ctx: Context): Option[(List[Type], Type, Boolean, Boolean)] = { val tsym = ft.typeSymbol if (isFunctionClass(tsym)) { val targs = ft.dealias.argInfos @@ -846,9 +847,9 @@ class Definitions { } object PartialFunctionOf { - def apply(arg: Type, result: Type)(implicit ctx: Context) = + def apply(arg: Type, result: Type)(implicit ctx: Context): Type = PartialFunctionType.appliedTo(arg :: result :: Nil) - def unapply(pft: Type)(implicit ctx: Context) = { + def unapply(pft: Type)(implicit ctx: Context): Option[(Type, List[Type])] = { if (pft.isRef(PartialFunctionClass)) { val targs = pft.dealias.argInfos if (targs.length == 2) Some((targs.head, targs.tail)) else None @@ -858,7 +859,7 @@ class Definitions { } object ArrayOf { - def apply(elem: Type)(implicit ctx: Context) = + def apply(elem: Type)(implicit ctx: Context): Type = if (ctx.erasedTypes) JavaArrayType(elem) else ArrayType.appliedTo(elem :: Nil) def unapply(tp: Type)(implicit ctx: Context): Option[Type] = tp.dealias match { @@ -893,20 +894,20 @@ class Definitions { } } - final def isTypelevel_S(sym: Symbol)(implicit ctx: Context) = + final def isTypelevel_S(sym: Symbol)(implicit ctx: Context): Boolean = sym.name == tpnme.S && sym.owner == TypelevelPackageObject // ----- Symbol sets --------------------------------------------------- - lazy val AbstractFunctionType = mkArityArray("scala.runtime.AbstractFunction", MaxImplementedFunctionArity, 0) - val AbstractFunctionClassPerRun = new PerRun[Array[Symbol]](implicit ctx => AbstractFunctionType.map(_.symbol.asClass)) - def AbstractFunctionClass(n: Int)(implicit ctx: Context) = AbstractFunctionClassPerRun()(ctx)(n) + lazy val AbstractFunctionType: Array[TypeRef] = mkArityArray("scala.runtime.AbstractFunction", MaxImplementedFunctionArity, 0) + val AbstractFunctionClassPerRun: PerRun[Array[Symbol]] = new PerRun[Array[Symbol]](implicit ctx => AbstractFunctionType.map(_.symbol.asClass)) + def AbstractFunctionClass(n: Int)(implicit ctx: Context): Symbol = AbstractFunctionClassPerRun()(ctx)(n) private lazy val ImplementedFunctionType = mkArityArray("scala.Function", MaxImplementedFunctionArity, 0) - def FunctionClassPerRun = new PerRun[Array[Symbol]](implicit ctx => ImplementedFunctionType.map(_.symbol.asClass)) + def FunctionClassPerRun: PerRun[Array[Symbol]] = new PerRun[Array[Symbol]](implicit ctx => ImplementedFunctionType.map(_.symbol.asClass)) - lazy val TupleType = mkArityArray("scala.Tuple", MaxTupleArity, 1) + lazy val TupleType: Array[TypeRef] = mkArityArray("scala.Tuple", MaxTupleArity, 1) - def FunctionClass(n: Int, isImplicit: Boolean = false, isErased: Boolean = false)(implicit ctx: Context) = + def FunctionClass(n: Int, isImplicit: Boolean = false, isErased: Boolean = false)(implicit ctx: Context): Symbol = if (isImplicit && isErased) ctx.requiredClass("scala.ErasedImplicitFunction" + n.toString) else if (isImplicit) @@ -918,8 +919,8 @@ class Definitions { else ctx.requiredClass("scala.Function" + n.toString) - lazy val Function0_applyR = ImplementedFunctionType(0).symbol.requiredMethodRef(nme.apply) - def Function0_apply(implicit ctx: Context) = Function0_applyR.symbol + lazy val Function0_applyR: Types.TermRef = ImplementedFunctionType(0).symbol.requiredMethodRef(nme.apply) + def Function0_apply(implicit ctx: Context): Symbol = Function0_applyR.symbol def FunctionType(n: Int, isImplicit: Boolean = false, isErased: Boolean = false)(implicit ctx: Context): TypeRef = if (n <= MaxImplementedFunctionArity && (!isImplicit || ctx.erasedTypes) && !isErased) ImplementedFunctionType(n) @@ -939,9 +940,9 @@ class Definitions { name.length > prefix.length && name.drop(prefix.length).forall(_.isDigit)) - def isBottomClass(cls: Symbol) = + def isBottomClass(cls: Symbol): Boolean = cls == NothingClass || cls == NullClass - def isBottomType(tp: Type) = + def isBottomType(tp: Type): Boolean = tp.derivesFrom(NothingClass) || tp.derivesFrom(NullClass) /** Is a function class. @@ -950,37 +951,37 @@ class Definitions { * - ErasedFunctionN for N > 0 * - ErasedImplicitFunctionN for N > 0 */ - def isFunctionClass(cls: Symbol) = scalaClassName(cls).isFunction + def isFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isFunction /** Is an implicit function class. * - ImplicitFunctionN for N >= 0 * - ErasedImplicitFunctionN for N > 0 */ - def isImplicitFunctionClass(cls: Symbol) = scalaClassName(cls).isImplicitFunction + def isImplicitFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isImplicitFunction /** Is an erased function class. * - ErasedFunctionN for N > 0 * - ErasedImplicitFunctionN for N > 0 */ - def isErasedFunctionClass(cls: Symbol) = scalaClassName(cls).isErasedFunction + def isErasedFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isErasedFunction /** Is a class that will be erased to FunctionXXL * - FunctionN for N >= 22 * - ImplicitFunctionN for N >= 22 */ - def isXXLFunctionClass(cls: Symbol) = scalaClassName(cls).functionArity > MaxImplementedFunctionArity + def isXXLFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).functionArity > MaxImplementedFunctionArity /** Is a synthetic function class * - FunctionN for N > 22 * - ImplicitFunctionN for N > 0 */ - def isSyntheticFunctionClass(cls: Symbol) = scalaClassName(cls).isSyntheticFunction + def isSyntheticFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isSyntheticFunction - def isAbstractFunctionClass(cls: Symbol) = isVarArityClass(cls, str.AbstractFunction) - def isTupleClass(cls: Symbol) = isVarArityClass(cls, str.Tuple) - def isProductClass(cls: Symbol) = isVarArityClass(cls, str.Product) + def isAbstractFunctionClass(cls: Symbol): Boolean = isVarArityClass(cls, str.AbstractFunction) + def isTupleClass(cls: Symbol): Boolean = isVarArityClass(cls, str.Tuple) + def isProductClass(cls: Symbol): Boolean = isVarArityClass(cls, str.Product) - def isScalaShadowingPackageClass(cls: Symbol) = + def isScalaShadowingPackageClass(cls: Symbol): Boolean = cls.name == tpnme.scalaShadowing && cls.owner == RootClass /** Returns the erased class of the function class `cls` @@ -1021,32 +1022,32 @@ class Definitions { Set("Predef$", "DeprecatedPredef", "LowPriorityImplicits").map(_.toTypeName.unmangleClassName) /** Is `cls` the predef module class, or a class inherited by Predef? */ - def isPredefClass(cls: Symbol) = + def isPredefClass(cls: Symbol): Boolean = (cls.owner eq ScalaPackageClass) && predefClassNames.contains(cls.name) - val StaticRootImportFns = List[() => TermRef]( + val StaticRootImportFns: List[() => Types.TermRef] = List[() => TermRef]( () => JavaLangPackageVal.termRef, () => ScalaPackageVal.termRef ) - val PredefImportFns = List[() => TermRef]( + val PredefImportFns: List[() => Types.TermRef] = List[() => TermRef]( () => ScalaPredefModuleRef, () => DottyPredefModuleRef ) - lazy val RootImportFns = + lazy val RootImportFns: List[() => Types.TermRef] = if (ctx.settings.YnoImports.value) List.empty[() => TermRef] else if (ctx.settings.YnoPredef.value) StaticRootImportFns else StaticRootImportFns ++ PredefImportFns - lazy val ShadowableImportNames = Set("Predef", "DottyPredef").map(_.toTermName) - lazy val RootImportTypes = RootImportFns.map(_()) + lazy val ShadowableImportNames: Set[TermName] = Set("Predef", "DottyPredef").map(_.toTermName) + lazy val RootImportTypes: List[TermRef] = RootImportFns.map(_()) /** Modules whose members are in the default namespace and their module classes */ lazy val UnqualifiedOwnerTypes: Set[NamedType] = RootImportTypes.toSet[NamedType] ++ RootImportTypes.map(_.symbol.moduleClass.typeRef) - lazy val NotRuntimeClasses = Set[Symbol](AnyClass, AnyValClass, NullClass, NothingClass) + lazy val NotRuntimeClasses: Set[Symbol] = Set[Symbol](AnyClass, AnyValClass, NullClass, NothingClass) /** Classes that are known not to have an initializer irrespective of * whether NoInits is set. Note: FunctionXXLClass is in this set @@ -1058,34 +1059,34 @@ class Definitions { * trait gets screwed up. Therefore, it is mandatory that FunctionXXL * is treated as a NoInit trait. */ - lazy val NoInitClasses = NotRuntimeClasses + FunctionXXLClass + lazy val NoInitClasses: Set[Symbol] = NotRuntimeClasses + FunctionXXLClass - def isPolymorphicAfterErasure(sym: Symbol) = + def isPolymorphicAfterErasure(sym: Symbol): Boolean = (sym eq Any_isInstanceOf) || (sym eq Any_asInstanceOf) - def isTupleType(tp: Type)(implicit ctx: Context) = { + def isTupleType(tp: Type)(implicit ctx: Context): Boolean = { val arity = tp.dealias.argInfos.length arity <= MaxTupleArity && TupleType(arity) != null && (tp isRef TupleType(arity).symbol) } - def tupleType(elems: List[Type]) = { + def tupleType(elems: List[Type]): Type = { TupleType(elems.size).appliedTo(elems) } - def isProductSubType(tp: Type)(implicit ctx: Context) = + def isProductSubType(tp: Type)(implicit ctx: Context): Boolean = tp.derivesFrom(ProductType.symbol) /** Is `tp` (an alias) of either a scala.FunctionN or a scala.ImplicitFunctionN * instance? */ - def isNonDepFunctionType(tp: Type)(implicit ctx: Context) = { + def isNonDepFunctionType(tp: Type)(implicit ctx: Context): Boolean = { val arity = functionArity(tp) val sym = tp.dealias.typeSymbol arity >= 0 && isFunctionClass(sym) && tp.isRef(FunctionType(arity, sym.name.isImplicitFunction, sym.name.isErasedFunction).typeSymbol) } /** Is `tp` a representation of a (possibly depenent) function type or an alias of such? */ - def isFunctionType(tp: Type)(implicit ctx: Context) = + def isFunctionType(tp: Type)(implicit ctx: Context): Boolean = isNonDepFunctionType(tp.dropDependentRefinement) // Specialized type parameters defined for scala.Function{0,1,2}. @@ -1100,18 +1101,18 @@ class Definitions { lazy val Function2SpecializedReturnTypes: collection.Set[TypeRef] = Function1SpecializedReturnTypes - lazy val Function1SpecializedParamClasses = + lazy val Function1SpecializedParamClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => Function1SpecializedParamTypes.map(_.symbol)) - lazy val Function2SpecializedParamClasses = + lazy val Function2SpecializedParamClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => Function2SpecializedParamTypes.map(_.symbol)) - lazy val Function0SpecializedReturnClasses = + lazy val Function0SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => Function0SpecializedReturnTypes.map(_.symbol)) - lazy val Function1SpecializedReturnClasses = + lazy val Function1SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => Function1SpecializedReturnTypes.map(_.symbol)) - lazy val Function2SpecializedReturnClasses = + lazy val Function2SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => Function2SpecializedReturnTypes.map(_.symbol)) - def isSpecializableFunction(cls: ClassSymbol, paramTypes: List[Type], retType: Type)(implicit ctx: Context) = + def isSpecializableFunction(cls: ClassSymbol, paramTypes: List[Type], retType: Type)(implicit ctx: Context): Boolean = paramTypes.length <= 2 && cls.derivesFrom(FunctionClass(paramTypes.length)) && (paramTypes match { case Nil => Function0SpecializedReturnClasses().contains(retType.typeSymbol) @@ -1126,7 +1127,7 @@ class Definitions { false }) - def functionArity(tp: Type)(implicit ctx: Context) = tp.dealias.argInfos.length - 1 + def functionArity(tp: Type)(implicit ctx: Context): Int = tp.dealias.argInfos.length - 1 /** Return underlying immplicit function type (i.e. instance of an ImplicitFunctionN class) * or NoType if none exists. The following types are considered as underlying types: @@ -1147,11 +1148,11 @@ class Definitions { def isImplicitFunctionType(tp: Type)(implicit ctx: Context): Boolean = asImplicitFunctionType(tp).exists - def isErasedFunctionType(tp: Type)(implicit ctx: Context) = + def isErasedFunctionType(tp: Type)(implicit ctx: Context): Boolean = isFunctionType(tp) && tp.dealias.typeSymbol.name.isErasedFunction /** A whitelist of Scala-2 classes that are known to be pure */ - def isAssuredNoInits(sym: Symbol) = + def isAssuredNoInits(sym: Symbol): Boolean = (sym `eq` SomeClass) || isTupleClass(sym) /** If `cls` is Tuple1..Tuple22, add the corresponding *: type as last parent to `parents` */ @@ -1177,16 +1178,16 @@ class Definitions { } } - lazy val ScalaNumericValueTypeList = List( + lazy val ScalaNumericValueTypeList: List[TypeRef] = List( ByteType, ShortType, CharType, IntType, LongType, FloatType, DoubleType) private lazy val ScalaNumericValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypeList.toSet private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes + UnitType + BooleanType private lazy val ScalaBoxedTypes = ScalaValueTypes map (t => boxedTypes(t.name)) - val ScalaNumericValueClasses = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaNumericValueTypes.map(_.symbol)) - val ScalaValueClasses = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaValueTypes.map(_.symbol)) - val ScalaBoxedClasses = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaBoxedTypes.map(_.symbol)) + val ScalaNumericValueClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaNumericValueTypes.map(_.symbol)) + val ScalaValueClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaValueTypes.map(_.symbol)) + val ScalaBoxedClasses: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]](implicit ctx => ScalaBoxedTypes.map(_.symbol)) private val boxedTypes = mutable.Map[TypeName, TypeRef]() private val valueTypeEnc = mutable.Map[TypeName, PrimitiveClassEnc]() @@ -1219,27 +1220,27 @@ class Definitions { type PrimitiveClassEnc = Int - val ByteEnc = 2 - val ShortEnc = ByteEnc * 3 - val CharEnc = 5 - val IntEnc = ShortEnc * CharEnc - val LongEnc = IntEnc * 7 - val FloatEnc = LongEnc * 11 - val DoubleEnc = FloatEnc * 13 - val BooleanEnc = 17 - val UnitEnc = 19 - - def isValueSubType(tref1: TypeRef, tref2: TypeRef)(implicit ctx: Context) = + val ByteEnc: Int = 2 + val ShortEnc: Int = ByteEnc * 3 + val CharEnc: Int = 5 + val IntEnc: Int = ShortEnc * CharEnc + val LongEnc: Int = IntEnc * 7 + val FloatEnc: Int = LongEnc * 11 + val DoubleEnc: Int = FloatEnc * 13 + val BooleanEnc: Int = 17 + val UnitEnc: Int = 19 + + def isValueSubType(tref1: TypeRef, tref2: TypeRef)(implicit ctx: Context): Boolean = valueTypeEnc(tref2.name) % valueTypeEnc(tref1.name) == 0 - def isValueSubClass(sym1: Symbol, sym2: Symbol) = + def isValueSubClass(sym1: Symbol, sym2: Symbol): Boolean = valueTypeEnc(sym2.asClass.name) % valueTypeEnc(sym1.asClass.name) == 0 - lazy val erasedToObject = Set[Symbol](AnyClass, AnyValClass, TupleClass, NonEmptyTupleClass, SingletonClass) + lazy val erasedToObject: Set[Symbol] = Set[Symbol](AnyClass, AnyValClass, TupleClass, NonEmptyTupleClass, SingletonClass) // ----- Initialization --------------------------------------------------- /** Lists core classes that don't have underlying bytecode, but are synthesized on-the-fly in every reflection universe */ - lazy val syntheticScalaClasses = List( + lazy val syntheticScalaClasses: List[TypeSymbol] = List( AnyClass, AnyRefAlias, AnyKindClass, @@ -1251,19 +1252,19 @@ class Definitions { SingletonClass, EqualsPatternClass) - lazy val syntheticCoreClasses = syntheticScalaClasses ++ List( + lazy val syntheticCoreClasses: List[Symbols.Symbol { type ThisName >: TypeName with Names.TermName <: Name { type ThisName >: TypeName with Names.TermName <: Name } }] = syntheticScalaClasses ++ List( EmptyPackageVal, OpsPackageClass) /** Lists core methods that don't have underlying bytecode, but are synthesized on-the-fly in every reflection universe */ - lazy val syntheticCoreMethods = + lazy val syntheticCoreMethods: List[Symbols.TermSymbol] = AnyMethods ++ ObjectMethods ++ List(String_+, throwMethod) lazy val reservedScalaClassNames: Set[Name] = syntheticScalaClasses.map(_.name).toSet private[this] var isInitialized = false - def init()(implicit ctx: Context) = { + def init()(implicit ctx: Context): Unit = { this.ctx = ctx if (!isInitialized) { // Enter all symbols from the scalaShadowing package in the scala package diff --git a/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala b/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala index af4f94421450..f8ea4fde1104 100644 --- a/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala +++ b/compiler/src/dotty/tools/dotc/core/DenotTransformers.scala @@ -20,7 +20,7 @@ object DenotTransformers { trait DenotTransformer extends Phase { /** The last phase during which the transformed denotations are valid */ - def lastPhaseId(implicit ctx: Context) = ctx.base.nextDenotTransformerId(id + 1) + def lastPhaseId(implicit ctx: Context): Int = ctx.base.nextDenotTransformerId(id + 1) /** The validity period of the transformed denotations in the given context */ def validFor(implicit ctx: Context): Period = diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala index 7146b98e2041..926e74ce7b6e 100644 --- a/compiler/src/dotty/tools/dotc/core/Denotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala @@ -2,7 +2,7 @@ package dotty.tools package dotc package core -import SymDenotations.{ SymDenotation, ClassDenotation, NoDenotation } +import SymDenotations.{ SymDenotation, ClassDenotation, NoDenotation, LazyType } import Contexts.{Context, ContextBase} import Names._ import NameKinds._ @@ -20,7 +20,6 @@ import io.AbstractFile import config.Config import util.common._ import collection.mutable.ListBuffer -import SymDenotations.LazyType /** Denotations represent the meaning of symbols and named types. * The following diagram shows how the principal types of denotations @@ -198,7 +197,7 @@ object Denotations { def isTerm: Boolean = !isType /** Is this denotation overloaded? */ - final def isOverloaded = isInstanceOf[MultiDenotation] + final def isOverloaded: Boolean = isInstanceOf[MultiDenotation] /** Denotation points to unique symbol; false for overloaded denotations * and JointRef denotations. @@ -230,7 +229,7 @@ object Denotations { def mapInfo(f: Type => Type)(implicit ctx: Context): Denotation /** If this denotation does not exist, fallback to alternative */ - final def orElse(that: => Denotation) = if (this.exists) this else that + final def orElse(that: => Denotation): Denotation = if (this.exists) this else that /** The set of alternative single-denotations making up this denotation */ final def alternatives: List[SingleDenotation] = altsWith(alwaysTrue) @@ -669,8 +668,8 @@ object Denotations { } } - final def asSingleDenotation = asInstanceOf[SingleDenotation] - final def asSymDenotation = asInstanceOf[SymDenotation] + final def asSingleDenotation: SingleDenotation = asInstanceOf[SingleDenotation] + final def asSymDenotation: SymDenotation = asInstanceOf[SymDenotation] def toText(printer: Printer): Text = printer.toText(this) @@ -706,7 +705,7 @@ object Denotations { def mapInfo(f: Type => Type)(implicit ctx: Context): SingleDenotation = derivedSingleDenotation(symbol, f(info)) - def orElse(that: => SingleDenotation) = if (this.exists) this else that + def orElse(that: => SingleDenotation): SingleDenotation = if (this.exists) this else that def altsWith(p: Symbol => Boolean): List[SingleDenotation] = if (exists && p(symbol)) this :: Nil else Nil @@ -751,8 +750,8 @@ object Denotations { private[this] var myValidFor: Period = Nowhere - def validFor = myValidFor - def validFor_=(p: Period) = { + def validFor: Period = myValidFor + def validFor_=(p: Period): Unit = { myValidFor = p symbol.invalidateDenotCache() } @@ -1017,7 +1016,7 @@ object Denotations { nextInRun = newd } - def staleSymbolError(implicit ctx: Context) = + def staleSymbolError(implicit ctx: Context): Nothing = throw new StaleSymbol(staleSymbolMsg) def staleSymbolMsg(implicit ctx: Context): String = { @@ -1049,7 +1048,7 @@ object Denotations { */ def showDcl(implicit ctx: Context): String = ctx.printer.dclText(this).show - override def toString = + override def toString: String = if (symbol == NoSymbol) symbol.toString else s"" @@ -1068,8 +1067,8 @@ object Denotations { // ------ PreDenotation ops ---------------------------------------------- - final def first = this - final def last = this + final def first: SingleDenotation = this + final def last: SingleDenotation = this final def matches(other: SingleDenotation)(implicit ctx: Context): Boolean = { val d = signature.matchDegree(other.signature) @@ -1107,7 +1106,7 @@ object Denotations { abstract class NonSymSingleDenotation(symbol: Symbol, initInfo: Type) extends SingleDenotation(symbol, initInfo) { def infoOrCompleter: Type = initInfo - def isType = infoOrCompleter.isInstanceOf[TypeType] + def isType: Boolean = infoOrCompleter.isInstanceOf[TypeType] } class UniqueRefDenotation( @@ -1124,13 +1123,13 @@ object Denotations { initInfo: Type, initValidFor: Period) extends NonSymSingleDenotation(symbol, initInfo) { validFor = initValidFor - override def hasUniqueSym = false + override def hasUniqueSym: Boolean = false protected def newLikeThis(s: Symbol, i: Type): SingleDenotation = new JointRefDenotation(s, i, validFor) } class ErrorDenotation(implicit ctx: Context) extends NonSymSingleDenotation(NoSymbol, NoType) { - override def exists = false - override def hasUniqueSym = false + override def exists: Boolean = false + override def hasUniqueSym: Boolean = false validFor = Period.allInRun(ctx.runId) protected def newLikeThis(s: Symbol, i: Type): SingleDenotation = this } @@ -1176,8 +1175,8 @@ object Denotations { def denot2: PreDenotation assert(denot1.exists && denot2.exists, s"Union of non-existing denotations ($denot1) and ($denot2)") - def first = denot1.first - def last = denot2.last + def first: Denotation = denot1.first + def last: Denotation = denot2.last def matches(other: SingleDenotation)(implicit ctx: Context): Boolean = denot1.matches(other) || denot2.matches(other) def filterWithPredicate(p: SingleDenotation => Boolean): PreDenotation = @@ -1188,16 +1187,16 @@ object Denotations { derivedUnion(denot1.mapInherited(owndenot, prevdenot, pre), denot2.mapInherited(owndenot, prevdenot, pre)) def filterExcluded(excluded: FlagSet)(implicit ctx: Context): PreDenotation = derivedUnion(denot1.filterExcluded(excluded), denot2.filterExcluded(excluded)) - protected def derivedUnion(denot1: PreDenotation, denot2: PreDenotation) = + protected def derivedUnion(denot1: PreDenotation, denot2: PreDenotation): PreDenotation = if ((denot1 eq this.denot1) && (denot2 eq this.denot2)) this else denot1 union denot2 } final case class DenotUnion(denot1: PreDenotation, denot2: PreDenotation) extends MultiPreDenotation { - def exists = true - def toDenot(pre: Type)(implicit ctx: Context) = + def exists: Boolean = true + def toDenot(pre: Type)(implicit ctx: Context): Denotation = (denot1 toDenot pre) & (denot2 toDenot pre, pre) - def containsSym(sym: Symbol) = + def containsSym(sym: Symbol): Boolean = (denot1 containsSym sym) || (denot2 containsSym sym) type AsSeenFromResult = PreDenotation def computeAsSeenFrom(pre: Type)(implicit ctx: Context): PreDenotation = @@ -1207,12 +1206,12 @@ object Denotations { /** An overloaded denotation consisting of the alternatives of both given denotations. */ case class MultiDenotation(denot1: Denotation, denot2: Denotation) extends Denotation(NoSymbol, NoType) with MultiPreDenotation { - final def infoOrCompleter = multiHasNot("info") - final def validFor = denot1.validFor & denot2.validFor - final def isType = false - final def hasUniqueSym = false - final def name(implicit ctx: Context) = denot1.name - final def signature(implicit ctx: Context) = Signature.OverloadedSignature + final def infoOrCompleter: Nothing = multiHasNot("info") + final def validFor: Period = denot1.validFor & denot2.validFor + final def isType: Boolean = false + final def hasUniqueSym: Boolean = false + final def name(implicit ctx: Context): Name = denot1.name + final def signature(implicit ctx: Context): Signature = Signature.OverloadedSignature def atSignature(sig: Signature, site: Type, relaxed: Boolean)(implicit ctx: Context): Denotation = if (sig eq Signature.OverloadedSignature) this else derivedUnionDenotation(denot1.atSignature(sig, site, relaxed), denot2.atSignature(sig, site, relaxed)) @@ -1249,7 +1248,7 @@ object Denotations { type AsSeenFromResult = Denotation def computeAsSeenFrom(pre: Type)(implicit ctx: Context): Denotation = derivedUnionDenotation(denot1.asSeenFrom(pre), denot2.asSeenFrom(pre)) - override def toString = alternatives.mkString(" ") + override def toString: String = alternatives.mkString(" ") private def multiHasNot(op: String): Nothing = throw new UnsupportedOperationException( @@ -1326,6 +1325,6 @@ object Denotations { /** An exception for accessing symbols that are no longer valid in current run */ class StaleSymbol(msg: => String) extends Exception { util.Stats.record("stale symbol") - override def getMessage() = msg + override def getMessage(): String = msg } } diff --git a/compiler/src/dotty/tools/dotc/core/Flags.scala b/compiler/src/dotty/tools/dotc/core/Flags.scala index 2cdceeec4e01..fff0c7054f64 100644 --- a/compiler/src/dotty/tools/dotc/core/Flags.scala +++ b/compiler/src/dotty/tools/dotc/core/Flags.scala @@ -28,10 +28,10 @@ object Flags { } /** The intersection of this flag set and the given flag set */ - def & (that: FlagSet) = FlagSet(bits & that.bits) + def & (that: FlagSet): FlagSet = FlagSet(bits & that.bits) /** The intersection of this flag set with the complement of the given flag set */ - def &~ (that: FlagSet) = { + def &~ (that: FlagSet): FlagSet = { val tbits = bits & KINDFLAGS if ((tbits & that.bits) == 0) this else FlagSet(tbits | ((this.bits & ~that.bits) & ~KINDFLAGS)) @@ -65,25 +65,25 @@ object Flags { */ def is(flags: FlagConjunction, butNot: FlagSet): Boolean = is(flags) && !is(butNot) - def isEmpty = (bits & ~KINDFLAGS) == 0 + def isEmpty: Boolean = (bits & ~KINDFLAGS) == 0 /** Is this flag set a subset of that one? */ - def <= (that: FlagSet) = (bits & that.bits) == bits + def <= (that: FlagSet): Boolean = (bits & that.bits) == bits /** Does this flag set apply to terms? */ - def isTermFlags = (bits & TERMS) != 0 + def isTermFlags: Boolean = (bits & TERMS) != 0 /** Does this flag set apply to terms? */ - def isTypeFlags = (bits & TYPES) != 0 + def isTypeFlags: Boolean = (bits & TYPES) != 0 /** This flag set with all flags transposed to be type flags */ - def toTypeFlags = if (bits == 0) this else FlagSet(bits & ~KINDFLAGS | TYPES) + def toTypeFlags: FlagSet = if (bits == 0) this else FlagSet(bits & ~KINDFLAGS | TYPES) /** This flag set with all flags transposed to be term flags */ - def toTermFlags = if (bits == 0) this else FlagSet(bits & ~KINDFLAGS | TERMS) + def toTermFlags: FlagSet = if (bits == 0) this else FlagSet(bits & ~KINDFLAGS | TERMS) /** This flag set with all flags transposed to be common flags */ - def toCommonFlags = if (bits == 0) this else FlagSet(bits | KINDFLAGS) + def toCommonFlags: FlagSet = if (bits == 0) this else FlagSet(bits | KINDFLAGS) /** The number of non-kind flags in this set */ def numFlags: Int = java.lang.Long.bitCount(bits & ~KINDFLAGS) @@ -116,7 +116,7 @@ object Flags { } /** The string representation of this flag set */ - override def toString = flagStrings.mkString(" ") + override def toString: String = flagStrings.mkString(" ") } /** A class representing flag sets that should be tested @@ -124,7 +124,7 @@ object Flags { * `x is fc` tests whether `x` contains all flags in `fc`. */ case class FlagConjunction(bits: Long) { - override def toString = FlagSet(bits).toString + override def toString: String = FlagSet(bits).toString } private final val TYPESHIFT = 2 @@ -192,255 +192,255 @@ object Flags { FlagConjunction((flags0 | union(flagss: _*)).bits) } - def commonFlags(flagss: FlagSet*) = union(flagss.map(_.toCommonFlags): _*) + def commonFlags(flagss: FlagSet*): FlagSet = union(flagss.map(_.toCommonFlags): _*) /** The empty flag set */ - final val EmptyFlags = FlagSet(0) + final val EmptyFlags: FlagSet = FlagSet(0) /** The undefined flag set */ - final val UndefinedFlags = FlagSet(~KINDFLAGS) + final val UndefinedFlags: FlagSet = FlagSet(~KINDFLAGS) // Available flags: /** Labeled with `private` modifier */ - final val Private = commonFlag(2, "private") - final val PrivateTerm = Private.toTermFlags - final val PrivateType = Private.toTypeFlags + final val Private: FlagSet = commonFlag(2, "private") + final val PrivateTerm: FlagSet = Private.toTermFlags + final val PrivateType: FlagSet = Private.toTypeFlags /** Labeled with `protected` modifier */ - final val Protected = commonFlag(3, "protected") + final val Protected: FlagSet = commonFlag(3, "protected") /** Labeled with `override` modifier */ - final val Override = commonFlag(4, "override") + final val Override: FlagSet = commonFlag(4, "override") /** A declared, but not defined member */ - final val Deferred = commonFlag(5, "") - final val DeferredTerm = Deferred.toTermFlags - final val DeferredType = Deferred.toTypeFlags + final val Deferred: FlagSet = commonFlag(5, "") + final val DeferredTerm: FlagSet = Deferred.toTermFlags + final val DeferredType: FlagSet = Deferred.toTypeFlags /** Labeled with `final` modifier */ - final val Final = commonFlag(6, "final") + final val Final: FlagSet = commonFlag(6, "final") /** A method symbol. */ - final val Method = termFlag(7, "") - final val HigherKinded = typeFlag(7, "") + final val Method: FlagSet = termFlag(7, "") + final val HigherKinded: FlagSet = typeFlag(7, "") /** A (term or type) parameter to a class or method */ - final val Param = commonFlag(8, "") - final val TermParam = Param.toTermFlags - final val TypeParam = Param.toTypeFlags + final val Param: FlagSet = commonFlag(8, "") + final val TermParam: FlagSet = Param.toTermFlags + final val TypeParam: FlagSet = Param.toTypeFlags /** Labeled with `implicit` modifier (implicit value) */ - final val ImplicitCommon = commonFlag(9, "implicit") - final val Implicit = ImplicitCommon.toTermFlags + final val ImplicitCommon: FlagSet = commonFlag(9, "implicit") + final val Implicit: FlagSet = ImplicitCommon.toTermFlags /** Labeled with `lazy` (a lazy val). */ - final val Lazy = termFlag(10, "lazy") + final val Lazy: FlagSet = termFlag(10, "lazy") /** A trait */ - final val Trait = typeFlag(10, "") + final val Trait: FlagSet = typeFlag(10, "") - final val LazyOrTrait = Lazy.toCommonFlags + final val LazyOrTrait: FlagSet = Lazy.toCommonFlags /** A value or variable accessor (getter or setter) */ - final val Accessor = termFlag(11, "") + final val Accessor: FlagSet = termFlag(11, "") /** Labeled with `sealed` modifier (sealed class) */ - final val Sealed = typeFlag(11, "sealed") + final val Sealed: FlagSet = typeFlag(11, "sealed") - final val AccessorOrSealed = Accessor.toCommonFlags + final val AccessorOrSealed: FlagSet = Accessor.toCommonFlags /** A mutable var */ - final val Mutable = termFlag(12, "mutable") + final val Mutable: FlagSet = termFlag(12, "mutable") /** Symbol is local to current class (i.e. private[this] or protected[this] * pre: Private or Protected are also set */ - final val Local = commonFlag(13, "") + final val Local: FlagSet = commonFlag(13, "") /** A field generated for a primary constructor parameter (no matter if it's a 'val' or not), * or an accessor of such a field. */ - final val ParamAccessor = termFlag(14, "") + final val ParamAccessor: FlagSet = termFlag(14, "") /** A value or class implementing a module */ - final val Module = commonFlag(15, "module") - final val ModuleVal = Module.toTermFlags - final val ModuleClass = Module.toTypeFlags + final val Module: FlagSet = commonFlag(15, "module") + final val ModuleVal: FlagSet = Module.toTermFlags + final val ModuleClass: FlagSet = Module.toTypeFlags /** A value or class representing a package */ - final val Package = commonFlag(16, "") - final val PackageVal = Package.toTermFlags - final val PackageClass = Package.toTypeFlags + final val Package: FlagSet = commonFlag(16, "") + final val PackageVal: FlagSet = Package.toTermFlags + final val PackageClass: FlagSet = Package.toTypeFlags /** A case class or its companion object */ - final val Case = commonFlag(17, "case") - final val CaseClass = Case.toTypeFlags - final val CaseVal = Case.toTermFlags + final val Case: FlagSet = commonFlag(17, "case") + final val CaseClass: FlagSet = Case.toTypeFlags + final val CaseVal: FlagSet = Case.toTermFlags /** A compiler-generated symbol, which is visible for type-checking * (compare with artifact) */ - final val Synthetic = commonFlag(18, "") + final val Synthetic: FlagSet = commonFlag(18, "") /** Labelled with `inline` modifier */ - final val Inline = commonFlag(19, "inline") + final val Inline: FlagSet = commonFlag(19, "inline") /** A covariant type variable / an outer accessor */ - final val CovariantOrOuter = commonFlag(20, "") - final val Covariant = typeFlag(20, "") - final val OuterAccessor = termFlag(20, "") + final val CovariantOrOuter: FlagSet = commonFlag(20, "") + final val Covariant: FlagSet = typeFlag(20, "") + final val OuterAccessor: FlagSet = termFlag(20, "") /** A contravariant type variable / a label method */ - final val ContravariantOrLabel = commonFlag(21, "") - final val Contravariant = typeFlag(21, "") - final val Label = termFlag(21, "