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

Backport "Update import wildcard from _ to * in compiler" to LTS #20774

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/MainGenericRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ object MainGenericRunner {

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

import scala.language.unsafeNulls

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

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

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

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

protected val primitives: DottyPrimitives

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

import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*

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

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

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

import ScalaPrimitivesOps._
import ScalaPrimitivesOps.*

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

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

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

/* Emits code to compare (and consume) stack-top and zero using the 'op' operator */
private def genCZJUMP(success: asm.Label, failure: asm.Label, op: TestOp, tk: BType, targetIfNoJump: asm.Label, negated: Boolean = false): Unit = {
import Primitives._
import Primitives.*
if (targetIfNoJump == success) genCZJUMP(failure, success, op.negate(), tk, targetIfNoJump, negated = !negated)
else {
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
Expand Down
36 changes: 18 additions & 18 deletions compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import scala.collection.mutable
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.ast.Trees
import dotty.tools.dotc.core.Annotations._
import dotty.tools.dotc.core.Constants._
import dotty.tools.dotc.core.Contexts._
import dotty.tools.dotc.core.Phases._
import dotty.tools.dotc.core.Decorators._
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.core.Annotations.*
import dotty.tools.dotc.core.Constants.*
import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Phases.*
import dotty.tools.dotc.core.Decorators.*
import dotty.tools.dotc.core.Flags.*
import dotty.tools.dotc.core.Names.Name
import dotty.tools.dotc.core.NameKinds.ExpandedName
import dotty.tools.dotc.core.Signature
import dotty.tools.dotc.core.StdNames._
import dotty.tools.dotc.core.StdNames.*
import dotty.tools.dotc.core.NameKinds
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.core.Types
import dotty.tools.dotc.core.Types._
import dotty.tools.dotc.core.Types.*
import dotty.tools.dotc.core.TypeErasure
import dotty.tools.dotc.transform.GenericSignatures
import dotty.tools.dotc.transform.ElimErasedValueType
Expand All @@ -44,12 +44,12 @@ import dotty.tools.backend.jvm.DottyBackendInterface.symExtensions
*/
trait BCodeHelpers extends BCodeIdiomatic {
// for some reason singleton types aren't allowed in constructor calls. will need several casts in code to enforce
//import global._
import bTypes._
import tpd._
import coreBTypes._
//import global.*
import bTypes.*
import tpd.*
import coreBTypes.*
import int.{_, given}
import DottyBackendInterface._
import DottyBackendInterface.*

// We need to access GenBCode phase to get access to post-processor components.
// At this point it should always be initialized already.
Expand Down Expand Up @@ -700,10 +700,10 @@ trait BCodeHelpers extends BCodeIdiomatic {
* classes.
*/
private def typeToTypeKind(tp: Type)(ct: BCodeHelpers)(storage: ct.BCInnerClassGen): ct.bTypes.BType = {
import ct.bTypes._
import ct.bTypes.*
val defn = ctx.definitions
import coreBTypes._
import Types._
import coreBTypes.*
import Types.*
/**
* Primitive types are represented as TypeRefs to the class symbol of, for example, scala.Int.
* The `primitiveTypeMap` maps those class symbols to the corresponding PrimitiveBType.
Expand Down Expand Up @@ -851,7 +851,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
object BCodeHelpers {

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

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


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

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

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

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

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

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

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

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

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

/**
* A BType is either a primitve type, a ClassBType, an ArrayBType of one of these, or a MethodType
Expand Down
18 changes: 9 additions & 9 deletions compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ 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._
import dotty.tools.dotc.core.Phases._
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Flags.*
import dotty.tools.dotc.core.Contexts.*
import dotty.tools.dotc.core.Phases.*
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.core.Phases.Phase
import dotty.tools.dotc.transform.SymUtils._
import dotty.tools.dotc.transform.SymUtils.*
import dotty.tools.dotc.core.StdNames
import dotty.tools.dotc.core.Phases

Expand All @@ -29,12 +29,12 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I, val frontendAcce
lazy val VolatileAttr = requiredClass[scala.volatile]

val bCodeAsmCommon: BCodeAsmCommon[int.type ] = new BCodeAsmCommon(int)
import bCodeAsmCommon._
import bCodeAsmCommon.*

val coreBTypes = new CoreBTypesFromSymbols[I]{
val bTypes: BTypesFromSymbols.this.type = BTypesFromSymbols.this
}
import coreBTypes._
import coreBTypes.*

@threadUnsafe protected lazy val classBTypeFromInternalNameMap =
collection.concurrent.TrieMap.empty[String, ClassBType]
Expand Down Expand Up @@ -285,7 +285,7 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I, val frontendAcce

val finalFlag = sym.is(Final) && !toDenot(sym).isClassConstructor && !sym.is(Mutable, butNot = Accessor) && !sym.enclosingClass.is(Trait)

import asm.Opcodes._
import asm.Opcodes.*
import GenBCodeOps.addFlagIf
0 .addFlagIf(privateFlag, ACC_PRIVATE)
.addFlagIf(!privateFlag, ACC_PUBLIC)
Expand All @@ -311,7 +311,7 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I, val frontendAcce
}

def javaFieldFlags(sym: Symbol) = {
import asm.Opcodes._
import asm.Opcodes.*
import GenBCodeOps.addFlagIf
javaFlags(sym)
.addFlagIf(sym.hasAnnotation(TransientAttr), ACC_TRANSIENT)
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/backend/jvm/BackendUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.tools.asm.Handle
import scala.tools.asm.tree.InvokeDynamicInsnNode
import asm.tree.ClassNode
import scala.collection.mutable
import scala.jdk.CollectionConverters._
import scala.jdk.CollectionConverters.*
import dotty.tools.dotc.report

import scala.language.unsafeNulls
Expand Down Expand Up @@ -92,9 +92,9 @@ class BackendUtils(val postProcessor: PostProcessor) {
* methods.
*/
def addLambdaDeserialize(classNode: ClassNode, implMethodsArray: Array[Handle]): Unit = {
import asm.Opcodes._
import bTypes._
import coreBTypes._
import asm.Opcodes.*
import bTypes.*
import coreBTypes.*

val cw = classNode

Expand Down
18 changes: 9 additions & 9 deletions compiler/src/dotty/tools/backend/jvm/CodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ 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.transform.SymUtils._
import scala.jdk.CollectionConverters.*
import dotty.tools.dotc.transform.SymUtils.*
import dotty.tools.dotc.interfaces
import dotty.tools.dotc.report

import java.util.Optional
import dotty.tools.dotc.sbt.ExtractDependencies
import dotty.tools.dotc.core._
import Contexts._
import Phases._
import Symbols._
import dotty.tools.dotc.core.*
import Contexts.*
import Phases.*
import Symbols.*
import StdNames.nme

import java.io.DataOutputStream
Expand All @@ -27,16 +27,16 @@ import java.nio.channels.ClosedByInterruptException
import dotty.tools.tasty.{ TastyBuffer, TastyHeaderUnpickler }

import scala.tools.asm
import scala.tools.asm.tree._
import tpd._
import scala.tools.asm.tree.*
import tpd.*
import dotty.tools.io.AbstractFile
import dotty.tools.dotc.util
import dotty.tools.dotc.util.NoSourcePosition


class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)( val bTypes: BTypesFromSymbols[int.type]) { self =>
import DottyBackendInterface.symExtensions
import bTypes._
import bTypes.*
import int.given

private lazy val mirrorCodeGen = Impl.JMirrorBuilder()
Expand Down
Loading