Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test run -rewrite of unused #22316

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions compiler/src/dotty/tools/MainGenericCompiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ import scala.annotation.tailrec
import scala.io.Source
import scala.util.Try
import java.io.File
import java.lang.Thread
import scala.annotation.internal.sharable
import dotty.tools.dotc.util.ClasspathFromClassloader
import dotty.tools.runner.ObjectRunner
import dotty.tools.dotc.config.Properties.envOrNone
import dotty.tools.io.Jar
import dotty.tools.runner.ScalaClassLoader
import java.nio.file.Paths
import dotty.tools.dotc.config.CommandLineParser
import dotty.tools.scripting.StringDriver

enum CompileMode:
case Guess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import scala.annotation.{switch, tailrec}
import scala.collection.mutable.SortedMap

import scala.tools.asm
import scala.tools.asm.{Handle, Opcodes}
import scala.tools.asm.Opcodes
import BCodeHelpers.InvokeStyle

import dotty.tools.dotc.ast.tpd
Expand Down
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import dotty.tools.dotc.core.Types.*
import dotty.tools.dotc.core.TypeErasure
import dotty.tools.dotc.transform.GenericSignatures
import dotty.tools.dotc.transform.ElimErasedValueType
import dotty.tools.io.AbstractFile
import dotty.tools.dotc.report

import dotty.tools.backend.jvm.DottyBackendInterface.symExtensions
Expand All @@ -49,7 +48,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
import bTypes.*
import tpd.*
import coreBTypes.*
import int.{_, given}
import int.given
import DottyBackendInterface.*

// We need to access GenBCode phase to get access to post-processor components.
Expand Down Expand Up @@ -380,7 +379,6 @@ trait BCodeHelpers extends BCodeIdiomatic {
} // end of trait BCAnnotGen

trait BCJGenSigGen {
import int.given

def getCurrentCUnit(): CompilationUnit

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait BCodeIdiomatic {
val int: DottyBackendInterface
val bTypes: BTypesFromSymbols[int.type]

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import dotty.tools.dotc.report
*
*/
trait BCodeSkelBuilder extends BCodeHelpers {
import int.{_, given}
import int.given
import DottyBackendInterface.{symExtensions, _}
import tpd.*
import bTypes.*
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ package jvm

import scala.tools.asm
import scala.annotation.threadUnsafe
import scala.collection.mutable
import scala.collection.mutable.Clearable

import dotty.tools.dotc.core.Flags.*
import dotty.tools.dotc.core.Contexts.*
Expand All @@ -14,7 +12,6 @@ import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.core.Phases.Phase

import dotty.tools.dotc.core.StdNames
import dotty.tools.dotc.core.Phases

/**
* This class mainly contains the method classBTypeFromSymbol, which extracts the necessary
Expand Down
2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/backend/jvm/BackendUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import scala.tools.asm.tree.InvokeDynamicInsnNode
import asm.tree.ClassNode
import scala.collection.mutable
import scala.jdk.CollectionConverters.*
import dotty.tools.dotc.report

import scala.language.unsafeNulls

Expand Down Expand Up @@ -76,7 +75,6 @@ class BackendUtils(val postProcessor: PostProcessor) {
*/
def addLambdaDeserialize(classNode: ClassNode, implMethodsArray: Array[Handle]): Unit = {
import asm.Opcodes.*
import bTypes.*
import coreBTypes.*

val cw = classNode
Expand Down
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ package dotty.tools.backend.jvm
import java.io.{DataOutputStream, File, IOException, BufferedOutputStream, FileOutputStream}
import java.nio.ByteBuffer
import java.nio.channels.{ClosedByInterruptException, FileChannel}
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.*
import java.nio.file.attribute.FileAttribute
import java.util
import java.util.concurrent.ConcurrentHashMap
import java.util.zip.{CRC32, Deflater, ZipEntry, ZipOutputStream}

import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Decorators.em
import dotty.tools.io.{AbstractFile, PlainFile, VirtualFile}
import dotty.tools.io.{AbstractFile, PlainFile}
import dotty.tools.io.PlainFile.toPlainFile
import BTypes.InternalName
import scala.util.chaining.*
Expand Down
5 changes: 0 additions & 5 deletions compiler/src/dotty/tools/backend/jvm/CodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import scala.language.unsafeNulls
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.ast.Trees.{PackageDef, ValDef}
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Phases.Phase

import scala.collection.mutable
import scala.jdk.CollectionConverters.*

import dotty.tools.dotc.interfaces
import dotty.tools.dotc.report
Expand All @@ -21,13 +19,10 @@ import Phases.*
import Symbols.*
import StdNames.nme

import java.io.DataOutputStream
import java.nio.channels.ClosedByInterruptException

import dotty.tools.tasty.{ TastyBuffer, TastyHeaderUnpickler }
import dotty.tools.dotc.core.tasty.TastyUnpickler

import scala.tools.asm
import scala.tools.asm.tree.*
import tpd.*
import dotty.tools.io.AbstractFile
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package jvm
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.transform.Erasure
import scala.tools.asm.{Handle, Opcodes}
import dotty.tools.dotc.core.StdNames
import BTypes.InternalName
import PostProcessorFrontendAccess.Lazy

abstract class CoreBTypes {
Expand Down Expand Up @@ -58,7 +56,6 @@ abstract class CoreBTypesFromSymbols[I <: DottyBackendInterface] extends CoreBTy

import bTypes.*
import DottyBackendInterface.*
import dotty.tools.dotc.core.Contexts.Context
import frontendAccess.perRunLazy
/**
* Maps primitive types to their corresponding PrimitiveBType. The map is defined lexically above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import dotty.tools.dotc.core.Flags.*
import java.io.{File => _}

import scala.reflect.ClassTag
import dotty.tools.io.AbstractFile
import dotty.tools.dotc.core.*
import Contexts.*
import Types.*
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/backend/jvm/GenBCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import Symbols.*
import dotty.tools.io.*
import scala.collection.mutable
import scala.compiletime.uninitialized
import java.util.concurrent.TimeoutException

import scala.concurrent.duration.Duration
import scala.concurrent.Await

class GenBCode extends Phase { self =>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dotty.tools.backend.jvm

import scala.language.unsafeNulls

import scala.tools.asm.{ClassReader, Type, Handle }
import scala.tools.asm.{Type, Handle }
import scala.tools.asm.tree.*

import scala.collection.mutable
Expand Down
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/backend/jvm/PostProcessor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package dotty.tools.backend.jvm

import java.util.concurrent.ConcurrentHashMap

import scala.collection.mutable.ListBuffer
import dotty.tools.dotc.util.{SourcePosition, NoSourcePosition}
import dotty.tools.dotc.util.SourcePosition
import dotty.tools.io.AbstractFile
import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Decorators.em
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package dotty.tools.backend.jvm

import scala.collection.mutable.{Clearable, HashSet}
import scala.collection.mutable.HashSet
import dotty.tools.dotc.util.*
import dotty.tools.dotc.reporting.Message
import dotty.tools.io.AbstractFile
import java.util.{Collection => JCollection, Map => JMap}
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.report
import dotty.tools.dotc.core.Phases
import scala.compiletime.uninitialized

/**
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/backend/sjs/JSPositions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class JSPositions()(using Context) {
sourceAndSpan2irPos(sourcePos.source, sourcePos.span)

private object span2irPosCache {
import dotty.tools.dotc.util.*

private var lastDotcSource: SourceFile = null
private var lastIRSource: ir.Position.SourceFile = null
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/CompilationUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import ast.Trees.{Import, Ident}
import typer.Nullables
import core.Decorators.*
import config.{SourceVersion, Feature}
import StdNames.nme
import scala.annotation.internal.sharable
import scala.util.control.NoStackTrace
import transform.MacroAnnotations.isMacroAnnotation
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/Driver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import dotty.tools.dotc.ast.Positioned
import dotty.tools.io.{AbstractFile, FileExtension}
import reporting.*
import core.Decorators.*
import config.Feature

import scala.util.control.NonFatal
import fromtasty.{TASTYCompiler, TastyFileUtil}
Expand Down
6 changes: 1 addition & 5 deletions compiler/src/dotty/tools/dotc/Run.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import typer.Typer
import typer.ImportInfo.withRootImports
import Decorators.*
import io.AbstractFile
import Phases.{unfusedPhases, Phase}
import Phases.Phase

import sbt.interfaces.ProgressCallback

Expand All @@ -22,17 +22,13 @@ import reporting.Diagnostic
import reporting.Diagnostic.Warning
import rewrites.Rewrites
import profile.Profiler
import printing.XprintMode
import typer.ImplicitRunInfo
import config.Feature
import StdNames.nme

import java.io.{BufferedWriter, OutputStreamWriter}
import java.nio.charset.StandardCharsets

import scala.collection.mutable
import scala.util.control.NonFatal
import scala.io.Codec

import Run.Progress
import scala.compiletime.uninitialized
Expand Down
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import core.*
import util.Spans.*, Types.*, Contexts.*, Constants.*, Names.*, NameOps.*, Flags.*
import Symbols.*, StdNames.*, Trees.*, ContextOps.*
import Decorators.*
import Annotations.Annotation
import NameKinds.{UniqueName, ContextBoundParamName, ContextFunctionParamName, DefaultGetterName, WildcardParamName}
import typer.{Namer, Checking}
import util.{Property, SourceFile, SourcePosition, SrcPos, Chars}
import config.{Feature, Config}
import config.Feature.{sourceVersion, migrateTo3, enabled, betterForsEnabled}
import config.Feature.betterForsEnabled
import config.SourceVersion.*
import collection.mutable
import reporting.*
Expand All @@ -21,7 +20,6 @@ import config.Printers
import parsing.Parsers

import scala.annotation.internal.sharable
import scala.annotation.threadUnsafe

object desugar {
import untpd.*
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import util.{Property, SourceFile}
import typer.ErrorReporting.*
import transform.SyntheticMembers.ExtendsSingletonMirror

import scala.annotation.internal.sharable

/** Helper methods to desugar enums */
object DesugarEnums {
Expand Down
8 changes: 2 additions & 6 deletions compiler/src/dotty/tools/dotc/ast/MainProxies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ package dotty.tools.dotc
package ast

import core.*
import Symbols.*, Types.*, Contexts.*, Decorators.*, util.Spans.*, Flags.*, Constants.*
import StdNames.{nme, tpnme}
import Symbols.*, Types.*, Contexts.*, Decorators.*, Flags.*, Constants.*
import StdNames.nme
import ast.Trees.*
import Names.Name
import Comments.Comment
import NameKinds.DefaultGetterName
import Annotations.Annotation

object MainProxies {

Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package ast
import core.*
import Flags.*, Trees.*, Types.*, Contexts.*
import Names.*, StdNames.*, NameOps.*, Symbols.*
import Annotations.Annotation
import NameKinds.ContextBoundParamName
import typer.ConstFold
import reporting.trace
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ast

import core.*
import Types.*, Contexts.*, Flags.*
import Symbols.*, Annotations.*, Trees.*, Symbols.*, Constants.Constant
import Annotations.*, Trees.*, Symbols.*, Constants.Constant
import Decorators.*


Expand Down
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ package ast
import dotty.tools.dotc.transform.{ExplicitOuter, Erasure}
import typer.ProtoTypes
import core.*
import Scopes.newScope
import util.Spans.*, Types.*, Contexts.*, Constants.*, Names.*, Flags.*, NameOps.*
import Symbols.*, StdNames.*, Annotations.*, Trees.*, Symbols.*
import StdNames.*, Annotations.*, Trees.*, Symbols.*
import Decorators.*, DenotTransformers.*
import collection.{immutable, mutable}
import util.{Property, SourceFile}
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/cc/CaptureAnnotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ package cc

import core.*
import Types.*, Symbols.*, Contexts.*, Annotations.*
import ast.Trees.*
import ast.{tpd, untpd}
import Decorators.*
import config.Printers.capt
import printing.Printer
import printing.Texts.Text

Expand All @@ -21,7 +19,6 @@ import printing.Texts.Text
* @param cls the underlying class (either annotation.retains or annotation.retainsByName)
*/
case class CaptureAnnotation(refs: CaptureSet, boxed: Boolean)(cls: Symbol) extends Annotation:
import CaptureAnnotation.*
import tpd.*

/** A cache for the version of this annotation which differs in its boxed status. */
Expand Down
5 changes: 2 additions & 3 deletions compiler/src/dotty/tools/dotc/cc/CaptureOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ package cc
import core.*
import Types.*, Symbols.*, Contexts.*, Annotations.*, Flags.*
import Names.TermName
import ast.{tpd, untpd}
import Decorators.*, NameOps.*
import ast.tpd
import Decorators.*
import config.SourceVersion
import config.Printers.capt
import util.Property.Key
import tpd.*
import StdNames.nme
import config.Feature
import collection.mutable
import CCState.*
Expand Down
7 changes: 2 additions & 5 deletions compiler/src/dotty/tools/dotc/cc/CaptureRef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ package dotc
package cc

import core.*
import Types.*, Symbols.*, Contexts.*, Decorators.*
import util.{SimpleIdentitySet, Property}
import typer.ErrorReporting.Addenda
import Types.*, Symbols.*, Contexts.*
import util.SimpleIdentitySet
import TypeComparer.subsumesExistentially
import util.common.alwaysTrue
import scala.collection.mutable
import CCState.*
import Periods.NoRunId
import compiletime.uninitialized
Expand Down
Loading
Loading