diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 088fbc9d2145..c6296c78d53f 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -139,10 +139,10 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma val externalEqualsNumNum: Symbol = defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum) val externalEqualsNumChar: Symbol = NoSymbol // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private val externalEqualsNumObject: Symbol = defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject) - val externalEquals: Symbol = defn.BoxesRunTimeClass.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol + val externalEquals: Symbol = defn.BoxesRunTimeModule.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol val MaxFunctionArity: Int = Definitions.MaxImplementedFunctionArity - val FunctionClass: Array[Symbol] = defn.FunctionClassPerRun() - val AbstractFunctionClass: Array[Symbol] = defn.AbstractFunctionClassPerRun() + val FunctionClass: Array[Symbol] = defn.FunctionClass + val AbstractFunctionClass: Array[Symbol] = defn.AbstractFunctionClass val PartialFunctionClass: Symbol = defn.PartialFunctionClass val AbstractPartialFunctionClass: Symbol = defn.AbstractPartialFunctionClass val String_valueOf: Symbol = defn.String_valueOf_Object @@ -154,11 +154,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma @threadUnsafe lazy val AnnotationRetentionRuntimeAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME") @threadUnsafe 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? + def boxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses.map{x => // @darkdimius Are you sure this should be a def? (x, Erasure.Boxing.boxMethod(x.asClass)) }.toMap def unboxMethods: Map[Symbol, Symbol] = - defn.ScalaValueClasses().map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap + defn.ScalaValueClasses.map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap override def isSyntheticArrayConstructor(s: Symbol): Boolean = { s eq defn.newArrayMethod diff --git a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala index b635c40b38b9..53cea2b37d20 100644 --- a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala +++ b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala @@ -1636,7 +1636,7 @@ class JSCodeGen()(implicit ctx: Context) { private lazy val externalEqualsNumObject: Symbol = defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject) private lazy val externalEquals: Symbol = - defn.BoxesRunTimeClass.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol + defn.BoxesRunTimeModule.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol /** Gen JS code for a call to Any.== */ private def genEqEqPrimitive(ltpe: Type, rtpe: Type, lsrc: js.Tree, rsrc: js.Tree)( @@ -2696,7 +2696,7 @@ class JSCodeGen()(implicit ctx: Context) { private object WrapArray { lazy val isWrapArray: Set[Symbol] = { - val names0 = defn.ScalaValueClasses().map(sym => nme.wrapXArray(sym.name)) + val names0 = defn.ScalaValueClasses.map(sym => nme.wrapXArray(sym.name)) val names1 = names0 ++ Set(nme.wrapRefArray, nme.genericWrapArray) val names2 = names1.map(defn.ScalaPredefModule.requiredMethod(_)) names2.toSet diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index ffe542a876a8..821ceff67893 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -641,7 +641,7 @@ object desugar { else if (isObject) parents1 = parents1 :+ scalaDot(nme.Serializable.toTypeName) if (isEnum) - parents1 = parents1 :+ ref(defn.EnumType) + parents1 = parents1 :+ ref(defn.EnumClass.typeRef) // derived type classes of non-module classes go to their companions val (clsDerived, companionDerived) = @@ -984,7 +984,7 @@ object desugar { def makeSelector(sel: Tree, checkMode: MatchCheck)(implicit ctx: Context): Tree = if (checkMode == MatchCheck.Exhaustive) sel else { - val sel1 = Annotated(sel, New(ref(defn.UncheckedAnnotType))) + val sel1 = Annotated(sel, New(ref(defn.UncheckedAnnot.typeRef))) if (checkMode != MatchCheck.None) sel1.pushAttachment(CheckIrrefutable, checkMode) sel1 } @@ -1560,7 +1560,7 @@ object desugar { val seqType = if (ctx.compilationUnit.isJava) defn.ArrayType else defn.SeqType Annotated( AppliedTypeTree(ref(seqType), t), - New(ref(defn.RepeatedAnnotType), Nil :: Nil)) + New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil)) } else { assert(ctx.mode.isExpr || ctx.reporter.errorsReported || ctx.mode.is(Mode.Interactive), ctx.mode) Select(t, op.name) diff --git a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala index 36f77612aae5..fd0a7275b8a3 100644 --- a/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala +++ b/compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala @@ -98,7 +98,7 @@ object DesugarEnums { .withFlags(Synthetic) val privateValuesDef = ValDef(nme.DOLLAR_VALUES, TypeTree(), - New(TypeTree(defn.EnumValuesType.appliedTo(enumClass.typeRef :: Nil)), ListOfNil)) + New(TypeTree(defn.EnumValuesClass.typeRef.appliedTo(enumClass.typeRef :: Nil)), ListOfNil)) .withFlags(Private) val valuesOfExnMessage = Apply( diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 4779854e51e4..821095dde886 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -966,7 +966,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val sym = tree.symbol if (sym.is(Method)) { val setter = sym.setter.orElse { - assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty) + assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty, sym) sym } val qual = tree match { @@ -1351,7 +1351,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { /** Creates the nested pairs type tree repesentation of the type trees in `ts` */ def nestedPairsTypeTree(ts: List[Tree])(implicit ctx: Context): Tree = - ts.foldRight[Tree](TypeTree(defn.UnitType))((x, acc) => AppliedTypeTree(TypeTree(defn.PairType), x :: acc :: Nil)) + ts.foldRight[Tree](TypeTree(defn.UnitType))((x, acc) => AppliedTypeTree(TypeTree(defn.PairClass.typeRef), x :: acc :: Nil)) /** Replaces all positions in `tree` with zero-extent positions */ private def focusPositions(tree: Tree)(implicit ctx: Context): Tree = { diff --git a/compiler/src/dotty/tools/dotc/core/Annotations.scala b/compiler/src/dotty/tools/dotc/core/Annotations.scala index 28cf9eda408c..528852c02817 100644 --- a/compiler/src/dotty/tools/dotc/core/Annotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Annotations.scala @@ -75,6 +75,7 @@ object Annotations { } case class LazyBodyAnnotation(private var bodyExpr: Context => Tree) extends BodyAnnotation { + // TODO: Make `bodyExpr` an IFT once #6865 os in bootstrap private[this] var evaluated = false private[this] var myBody: Tree = _ def tree(implicit ctx: Context): Tree = { @@ -159,17 +160,17 @@ object Annotations { object Child { /** A deferred annotation to the result of a given child computation */ - def apply(delayedSym: Context => Symbol, span: Span)(implicit ctx: Context): Annotation = { + def later(delayedSym: given Context => Symbol, span: Span)(implicit ctx: Context): Annotation = { def makeChildLater(implicit ctx: Context) = { - val sym = delayedSym(ctx) - New(defn.ChildAnnotType.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil) + val sym = delayedSym + New(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil) .withSpan(span) } deferred(defn.ChildAnnot)(makeChildLater(ctx)) } /** A regular, non-deferred Child annotation */ - def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = apply(_ => sym, span) + def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = later(given _ => sym, span) def unapply(ann: Annotation)(implicit ctx: Context): Option[Symbol] = if (ann.symbol == defn.ChildAnnot) { @@ -201,7 +202,7 @@ object Annotations { def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context): Annotation = { val tref = cls.typeRef - Annotation(defn.ThrowsAnnotType.appliedTo(tref), Ident(tref)) + Annotation(defn.ThrowsAnnot.typeRef.appliedTo(tref), Ident(tref)) } /** A decorator that provides queries for specific annotations diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index f1d705b9674c..317459341b0a 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -38,7 +38,7 @@ object Definitions { * Context to Symbol, and possibly also the corresponding type. This cuts down on all * the duplication encountered here. * - * wip-definitions tries to do the same with an implicit conversion from a SymbolPerRun + * wip-definitions tries to do the same with an implicit conversion from a Symbol * type to a symbol type. The problem with that is universal equality. Comparisons will * not trigger the conversion and will therefore likely return false results. * @@ -216,26 +216,21 @@ class Definitions { else NoSymbol) cls } - @threadUnsafe lazy val ScalaPackageObjectRef: TermRef = ctx.requiredModuleRef("scala.package") + @threadUnsafe lazy val ScalaPackageObject: Symbol = ctx.requiredModule("scala.package") @threadUnsafe lazy val JavaPackageVal: TermSymbol = ctx.requiredPackage(nme.java) @threadUnsafe lazy val JavaLangPackageVal: TermSymbol = ctx.requiredPackage(jnme.JavaLang) + // fundamental modules - @threadUnsafe lazy val SysPackage: TermSymbol = ctx.requiredModule("scala.sys.package") - @threadUnsafe lazy val Sys_errorR: TermRef = SysPackage.moduleClass.requiredMethodRef(nme.error) - def Sys_error(implicit ctx: Context): Symbol = Sys_errorR.symbol + @threadUnsafe lazy val SysPackage : Symbol = ctx.requiredModule("scala.sys.package") + @threadUnsafe lazy val Sys_error: Symbol = SysPackage.moduleClass.requiredMethod(nme.error) @threadUnsafe lazy val ScalaXmlPackageClass: Symbol = ctx.getPackageClassIfDefined("scala.xml") - @threadUnsafe lazy val CompiletimePackageObjectRef: TermRef = ctx.requiredModuleRef("scala.compiletime.package") - @threadUnsafe lazy val CompiletimePackageObject: Symbol = CompiletimePackageObjectRef.symbol.moduleClass - @threadUnsafe lazy val Compiletime_errorR: TermRef = CompiletimePackageObjectRef.symbol.requiredMethodRef(nme.error) - def Compiletime_error(implicit ctx: Context): Symbol = Compiletime_errorR.symbol - @threadUnsafe lazy val Compiletime_constValueR: TermRef = CompiletimePackageObjectRef.symbol.requiredMethodRef("constValue") - def Compiletime_constValue(implicit ctx: Context): Symbol = Compiletime_constValueR.symbol - @threadUnsafe lazy val Compiletime_constValueOptR: TermRef = CompiletimePackageObjectRef.symbol.requiredMethodRef("constValueOpt") - def Compiletime_constValueOpt(implicit ctx: Context): Symbol = Compiletime_constValueOptR.symbol - @threadUnsafe lazy val Compiletime_codeR: TermRef = CompiletimePackageObjectRef.symbol.requiredMethodRef("code") - def Compiletime_code(implicit ctx: Context): Symbol = Compiletime_codeR.symbol + @threadUnsafe lazy val CompiletimePackageObject: Symbol = ctx.requiredModule("scala.compiletime.package") + @threadUnsafe lazy val Compiletime_error : Symbol = CompiletimePackageObject.requiredMethod(nme.error) + @threadUnsafe lazy val Compiletime_constValue : Symbol = CompiletimePackageObject.requiredMethod("constValue") + @threadUnsafe lazy val Compiletime_constValueOpt: Symbol = CompiletimePackageObject.requiredMethod("constValueOpt") + @threadUnsafe lazy val Compiletime_code : Symbol = CompiletimePackageObject.requiredMethod("code") /** The `scalaShadowing` package is used to safely modify classes and * objects in scala so that they can be used from dotty. They will @@ -244,8 +239,7 @@ class Definitions { * in `scalaShadowing` so they don't clash with the same-named `scala` * members at runtime. */ - @threadUnsafe lazy val ScalaShadowingPackageVal: TermSymbol = ctx.requiredPackage(nme.scalaShadowing) - def ScalaShadowingPackageClass(implicit ctx: Context): ClassSymbol = ScalaShadowingPackageVal.moduleClass.asClass + @threadUnsafe lazy val ScalaShadowingPackage: TermSymbol = ctx.requiredPackage(nme.scalaShadowing) /** 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 @@ -355,67 +349,47 @@ class Definitions { @threadUnsafe lazy val NullClass: ClassSymbol = enterCompleteClassSymbol( ScalaPackageClass, tpnme.Null, AbstractFinal, List(ObjectClass.typeRef)) def NullType: TypeRef = NullClass.typeRef - @threadUnsafe lazy val RuntimeNullModuleRef: TermRef = ctx.requiredModuleRef("scala.runtime.Null") + @threadUnsafe lazy val RuntimeNothingModule: Symbol = ctx.requiredModule("scala.runtime.Nothing") + @threadUnsafe lazy val RuntimeNullModule: Symbol = ctx.requiredModule("scala.runtime.Null") @threadUnsafe lazy val ImplicitScrutineeTypeSym = newSymbol(ScalaPackageClass, tpnme.IMPLICITkw, EmptyFlags, TypeBounds.empty).entered def ImplicitScrutineeTypeRef: TypeRef = ImplicitScrutineeTypeSym.typeRef - @threadUnsafe lazy val ScalaPredefModuleRef: TermRef = ctx.requiredModuleRef("scala.Predef") - def ScalaPredefModule(implicit ctx: Context): Symbol = ScalaPredefModuleRef.symbol - @threadUnsafe lazy val Predef_conformsR: TermRef = ScalaPredefModule.requiredMethodRef(nme.conforms_) - def Predef_conforms(implicit ctx: Context): Symbol = Predef_conformsR.symbol - @threadUnsafe lazy val Predef_classOfR: TermRef = ScalaPredefModule.requiredMethodRef(nme.classOf) - def Predef_classOf(implicit ctx: Context): Symbol = Predef_classOfR.symbol - @threadUnsafe lazy val Predef_undefinedR: TermRef = ScalaPredefModule.requiredMethodRef(nme.???) - def Predef_undefined(implicit ctx: Context): Symbol = Predef_undefinedR.symbol - - def SubTypeClass(implicit ctx: Context): ClassSymbol = - if (isNewCollections) - ctx.requiredClass("scala.<:<") - else - ScalaPredefModule.requiredClass("<:<") - - def DummyImplicitClass(implicit ctx: Context): ClassSymbol = - if (isNewCollections) - ctx.requiredClass("scala.DummyImplicit") - else - ScalaPredefModule.requiredClass("DummyImplicit") + @threadUnsafe lazy val ScalaPredefModule: Symbol = ctx.requiredModule("scala.Predef") + @threadUnsafe lazy val Predef_conforms : Symbol = ScalaPredefModule.requiredMethod(nme.conforms_) + @threadUnsafe lazy val Predef_classOf : Symbol = ScalaPredefModule.requiredMethod(nme.classOf) + @threadUnsafe lazy val Predef_undefined: Symbol = ScalaPredefModule.requiredMethod(nme.???) - @threadUnsafe lazy val ScalaRuntimeModuleRef: TermRef = ctx.requiredModuleRef("scala.runtime.ScalaRunTime") - def ScalaRuntimeModule(implicit ctx: Context): Symbol = ScalaRuntimeModuleRef.symbol - def ScalaRuntimeClass(implicit ctx: Context): ClassSymbol = ScalaRuntimeModule.moduleClass.asClass + def SubTypeClass(implicit ctx: Context): Symbol = + if (isNewCollections) ctx.requiredClass("scala.<:<") + else ScalaPredefModule.requiredClass("<:<") - def runtimeMethodRef(name: PreName): TermRef = ScalaRuntimeModule.requiredMethodRef(name) - def ScalaRuntime_dropR(implicit ctx: Context): TermRef = runtimeMethodRef(nme.drop) - def ScalaRuntime_drop(implicit ctx: Context): Symbol = ScalaRuntime_dropR.symbol + def DummyImplicitClass(implicit ctx: Context): Symbol = + if (isNewCollections) ctx.requiredClass("scala.DummyImplicit") + else ScalaPredefModule.requiredClass("DummyImplicit") - @threadUnsafe lazy val BoxesRunTimeModuleRef: TermRef = ctx.requiredModuleRef("scala.runtime.BoxesRunTime") - def BoxesRunTimeModule(implicit ctx: Context): Symbol = BoxesRunTimeModuleRef.symbol - def BoxesRunTimeClass(implicit ctx: Context): ClassSymbol = BoxesRunTimeModule.moduleClass.asClass - @threadUnsafe lazy val ScalaStaticsModuleRef: TermRef = ctx.requiredModuleRef("scala.runtime.Statics") - def ScalaStaticsModule(implicit ctx: Context): Symbol = ScalaStaticsModuleRef.symbol - def ScalaStaticsClass(implicit ctx: Context): ClassSymbol = ScalaStaticsModule.moduleClass.asClass + @threadUnsafe lazy val ScalaRuntimeModule: Symbol = ctx.requiredModule("scala.runtime.ScalaRunTime") + def runtimeMethod(name: PreName): Symbol = ScalaRuntimeModule.requiredMethod(name) + def ScalaRuntime_drop: Symbol = runtimeMethod(nme.drop) - def staticsMethodRef(name: PreName): TermRef = ScalaStaticsModule.requiredMethodRef(name) + @threadUnsafe lazy val BoxesRunTimeModule: Symbol = ctx.requiredModule("scala.runtime.BoxesRunTime") + @threadUnsafe lazy val ScalaStaticsModule: Symbol = ctx.requiredModule("scala.runtime.Statics") def staticsMethod(name: PreName): TermSymbol = ScalaStaticsModule.requiredMethod(name) // Dotty deviation: we cannot use a @threadUnsafe lazy val here because @threadUnsafe lazy vals in dotty // will return "null" when called recursively, see #1856. - def DottyPredefModuleRef: TermRef = { - if (myDottyPredefModuleRef == null) { - myDottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef") - assert(myDottyPredefModuleRef != null) + def DottyPredefModule: Symbol = { + if (myDottyPredefModule == null) { + myDottyPredefModule = ctx.requiredModule("dotty.DottyPredef") + assert(myDottyPredefModule != null) } - myDottyPredefModuleRef + myDottyPredefModule } - private[this] var myDottyPredefModuleRef: TermRef = _ - - def DottyPredefModule(implicit ctx: Context): Symbol = DottyPredefModuleRef.symbol + private[this] var myDottyPredefModule: Symbol = _ - @threadUnsafe lazy val DottyArraysModuleRef: TermRef = ctx.requiredModuleRef("dotty.runtime.Arrays") - def DottyArraysModule(implicit ctx: Context): Symbol = DottyArraysModuleRef.symbol + @threadUnsafe lazy val DottyArraysModule: Symbol = ctx.requiredModule("dotty.runtime.Arrays") def newGenericArrayMethod(implicit ctx: Context): TermSymbol = DottyArraysModule.requiredMethod("newGenericArray") def newArrayMethod(implicit ctx: Context): TermSymbol = DottyArraysModule.requiredMethod("newArray") @@ -425,13 +399,12 @@ class Definitions { 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: PerRun[collection.Set[Symbol]] = new PerRun({ implicit ctx => + @threadUnsafe lazy val WrapArrayMethods: collection.Set[Symbol] = { val methodNames = ScalaValueTypes.map(ast.tpd.wrapArrayMethodName) + nme.wrapRefArray - methodNames.map(getWrapVarargsArrayModule.requiredMethodRef(_).symbol) - }) + methodNames.map(getWrapVarargsArrayModule.requiredMethod(_)) + } - @threadUnsafe lazy val NilModuleRef: TermRef = ctx.requiredModuleRef("scala.collection.immutable.Nil") - def NilModule(implicit ctx: Context): Symbol = NilModuleRef.symbol + @threadUnsafe lazy val NilModule: Symbol = ctx.requiredModule("scala.collection.immutable.Nil") @threadUnsafe lazy val SingletonClass: ClassSymbol = // needed as a synthetic class because Scala 2.x refers to it in classfiles @@ -444,141 +417,99 @@ class Definitions { @threadUnsafe lazy val SeqType: TypeRef = if (isNewCollections) ctx.requiredClassRef("scala.collection.immutable.Seq") else ctx.requiredClassRef("scala.collection.Seq") - def SeqClass(implicit ctx: Context): ClassSymbol = SeqType.symbol.asClass - @threadUnsafe lazy val Seq_applyR: TermRef = SeqClass.requiredMethodRef(nme.apply) - def Seq_apply(implicit ctx: Context): Symbol = Seq_applyR.symbol - @threadUnsafe lazy val Seq_headR: TermRef = SeqClass.requiredMethodRef(nme.head) - def Seq_head(implicit ctx: Context): Symbol = Seq_headR.symbol - @threadUnsafe lazy val Seq_dropR: TermRef = SeqClass.requiredMethodRef(nme.drop) - def Seq_drop(implicit ctx: Context): Symbol = Seq_dropR.symbol - @threadUnsafe lazy val Seq_lengthCompareR: TermRef = SeqClass.requiredMethodRef(nme.lengthCompare, List(IntType)) - def Seq_lengthCompare(implicit ctx: Context): Symbol = Seq_lengthCompareR.symbol - @threadUnsafe lazy val Seq_lengthR: TermRef = SeqClass.requiredMethodRef(nme.length) - def Seq_length(implicit ctx: Context): Symbol = Seq_lengthR.symbol - @threadUnsafe lazy val Seq_toSeqR: TermRef = SeqClass.requiredMethodRef(nme.toSeq) - def Seq_toSeq(implicit ctx: Context): Symbol = Seq_toSeqR.symbol + def SeqClass given Context: ClassSymbol = SeqType.symbol.asClass + @threadUnsafe lazy val Seq_apply : Symbol = SeqClass.requiredMethod(nme.apply) + @threadUnsafe lazy val Seq_head : Symbol = SeqClass.requiredMethod(nme.head) + @threadUnsafe lazy val Seq_drop : Symbol = SeqClass.requiredMethod(nme.drop) + @threadUnsafe lazy val Seq_lengthCompare: Symbol = SeqClass.requiredMethod(nme.lengthCompare, List(IntType)) + @threadUnsafe lazy val Seq_length : Symbol = SeqClass.requiredMethod(nme.length) + @threadUnsafe lazy val Seq_toSeq : Symbol = SeqClass.requiredMethod(nme.toSeq) @threadUnsafe lazy val ArrayType: TypeRef = ctx.requiredClassRef("scala.Array") - def ArrayClass(implicit ctx: Context): ClassSymbol = ArrayType.symbol.asClass - @threadUnsafe lazy val Array_applyR: TermRef = ArrayClass.requiredMethodRef(nme.apply) - def Array_apply(implicit ctx: Context): Symbol = Array_applyR.symbol - @threadUnsafe lazy val Array_updateR: TermRef = ArrayClass.requiredMethodRef(nme.update) - def Array_update(implicit ctx: Context): Symbol = Array_updateR.symbol - @threadUnsafe lazy val Array_lengthR: TermRef = ArrayClass.requiredMethodRef(nme.length) - def Array_length(implicit ctx: Context): Symbol = Array_lengthR.symbol - @threadUnsafe lazy val Array_cloneR: TermRef = ArrayClass.requiredMethodRef(nme.clone_) - def Array_clone(implicit ctx: Context): Symbol = Array_cloneR.symbol - @threadUnsafe lazy val ArrayConstructorR: TermRef = ArrayClass.requiredMethodRef(nme.CONSTRUCTOR) - def ArrayConstructor(implicit ctx: Context): Symbol = ArrayConstructorR.symbol - @threadUnsafe lazy val ArrayModuleType: TermRef = ctx.requiredModuleRef("scala.Array") - def ArrayModule(implicit ctx: Context): ClassSymbol = ArrayModuleType.symbol.moduleClass.asClass + def ArrayClass given Context: ClassSymbol = ArrayType.symbol.asClass + @threadUnsafe lazy val Array_apply : Symbol = ArrayClass.requiredMethod(nme.apply) + @threadUnsafe lazy val Array_update : Symbol = ArrayClass.requiredMethod(nme.update) + @threadUnsafe lazy val Array_length : Symbol = ArrayClass.requiredMethod(nme.length) + @threadUnsafe lazy val Array_clone : Symbol = ArrayClass.requiredMethod(nme.clone_) + @threadUnsafe lazy val ArrayConstructor: Symbol = ArrayClass.requiredMethod(nme.CONSTRUCTOR) + @threadUnsafe lazy val ArrayModule: Symbol = ctx.requiredModule("scala.Array") @threadUnsafe lazy val UnitType: TypeRef = valueTypeRef("scala.Unit", java.lang.Void.TYPE, UnitEnc, nme.specializedTypeNames.Void) - def UnitClass(implicit ctx: Context): ClassSymbol = UnitType.symbol.asClass - def UnitModuleClass(implicit ctx: Context): Symbol = UnitType.symbol.asClass.linkedClass + def UnitClass given Context: ClassSymbol = UnitType.symbol.asClass + def UnitModuleClass given Context: Symbol = UnitType.symbol.asClass.linkedClass @threadUnsafe lazy val BooleanType: TypeRef = valueTypeRef("scala.Boolean", java.lang.Boolean.TYPE, BooleanEnc, nme.specializedTypeNames.Boolean) - def BooleanClass(implicit ctx: Context): ClassSymbol = BooleanType.symbol.asClass - @threadUnsafe lazy val Boolean_notR: TermRef = BooleanClass.requiredMethodRef(nme.UNARY_!) - def Boolean_! : Symbol = Boolean_notR.symbol - @threadUnsafe lazy val Boolean_andR: TermRef = BooleanClass.requiredMethodRef(nme.ZAND) // ### harmonize required... calls - def Boolean_&& : Symbol = Boolean_andR.symbol - @threadUnsafe lazy val Boolean_orR: TermRef = BooleanClass.requiredMethodRef(nme.ZOR) - def Boolean_|| : Symbol = Boolean_orR.symbol - @threadUnsafe lazy val Boolean_eqeqR: SingleDenotation = BooleanClass.info.member(nme.EQ).suchThat(_.info.firstParamTypes match { - case List(pt) => (pt isRef BooleanClass) - case _ => false - }) - def Boolean_== : Symbol = Boolean_eqeqR.symbol - @threadUnsafe lazy val Boolean_neqeqR: SingleDenotation = BooleanClass.info.member(nme.NE).suchThat(_.info.firstParamTypes match { - case List(pt) => (pt isRef BooleanClass) - case _ => false - }) - def Boolean_!= : Symbol = Boolean_neqeqR.symbol + def BooleanClass given Context: ClassSymbol = BooleanType.symbol.asClass + @threadUnsafe lazy val Boolean_! : Symbol = BooleanClass.requiredMethod(nme.UNARY_!) + @threadUnsafe lazy val Boolean_&& : Symbol = BooleanClass.requiredMethod(nme.ZAND) // ### harmonize required... calls + @threadUnsafe lazy val Boolean_|| : Symbol = BooleanClass.requiredMethod(nme.ZOR) + @threadUnsafe lazy val Boolean_== : Symbol = + BooleanClass.info.member(nme.EQ).suchThat(_.info.firstParamTypes match { + case List(pt) => (pt isRef BooleanClass) + case _ => false + }).symbol + @threadUnsafe lazy val Boolean_!= : Symbol = + BooleanClass.info.member(nme.NE).suchThat(_.info.firstParamTypes match { + case List(pt) => (pt isRef BooleanClass) + case _ => false + }).symbol @threadUnsafe lazy val ByteType: TypeRef = valueTypeRef("scala.Byte", java.lang.Byte.TYPE, ByteEnc, nme.specializedTypeNames.Byte) - def ByteClass(implicit ctx: Context): ClassSymbol = ByteType.symbol.asClass + def ByteClass given Context: ClassSymbol = ByteType.symbol.asClass @threadUnsafe lazy val ShortType: TypeRef = valueTypeRef("scala.Short", java.lang.Short.TYPE, ShortEnc, nme.specializedTypeNames.Short) - def ShortClass(implicit ctx: Context): ClassSymbol = ShortType.symbol.asClass + def ShortClass given Context: ClassSymbol = ShortType.symbol.asClass @threadUnsafe lazy val CharType: TypeRef = valueTypeRef("scala.Char", java.lang.Character.TYPE, CharEnc, nme.specializedTypeNames.Char) - def CharClass(implicit ctx: Context): ClassSymbol = CharType.symbol.asClass + def CharClass given Context: ClassSymbol = CharType.symbol.asClass @threadUnsafe lazy val IntType: TypeRef = valueTypeRef("scala.Int", java.lang.Integer.TYPE, IntEnc, nme.specializedTypeNames.Int) - def IntClass(implicit ctx: Context): ClassSymbol = IntType.symbol.asClass - @threadUnsafe lazy val Int_minusR: TermRef = IntClass.requiredMethodRef(nme.MINUS, List(IntType)) - def Int_- : Symbol = Int_minusR.symbol - @threadUnsafe lazy val Int_plusR: TermRef = IntClass.requiredMethodRef(nme.PLUS, List(IntType)) - def Int_+ : Symbol = Int_plusR.symbol - @threadUnsafe lazy val Int_divR: TermRef = IntClass.requiredMethodRef(nme.DIV, List(IntType)) - def Int_/ : Symbol = Int_divR.symbol - @threadUnsafe lazy val Int_mulR: TermRef = IntClass.requiredMethodRef(nme.MUL, List(IntType)) - def Int_* : Symbol = Int_mulR.symbol - @threadUnsafe lazy val Int_eqR: TermRef = IntClass.requiredMethodRef(nme.EQ, List(IntType)) - def Int_== : Symbol = Int_eqR.symbol - @threadUnsafe lazy val Int_geR: TermRef = IntClass.requiredMethodRef(nme.GE, List(IntType)) - def Int_>= : Symbol = Int_geR.symbol - @threadUnsafe lazy val Int_leR: TermRef = IntClass.requiredMethodRef(nme.LE, List(IntType)) - def Int_<= : Symbol = Int_leR.symbol + def IntClass given Context: ClassSymbol = IntType.symbol.asClass + @threadUnsafe lazy val Int_- : Symbol = IntClass.requiredMethod(nme.MINUS, List(IntType)) + @threadUnsafe lazy val Int_+ : Symbol = IntClass.requiredMethod(nme.PLUS, List(IntType)) + @threadUnsafe lazy val Int_/ : Symbol = IntClass.requiredMethod(nme.DIV, List(IntType)) + @threadUnsafe lazy val Int_* : Symbol = IntClass.requiredMethod(nme.MUL, List(IntType)) + @threadUnsafe lazy val Int_== : Symbol = IntClass.requiredMethod(nme.EQ, List(IntType)) + @threadUnsafe lazy val Int_>= : Symbol = IntClass.requiredMethod(nme.GE, List(IntType)) + @threadUnsafe lazy val Int_<= : Symbol = IntClass.requiredMethod(nme.LE, List(IntType)) @threadUnsafe lazy val LongType: TypeRef = valueTypeRef("scala.Long", java.lang.Long.TYPE, LongEnc, nme.specializedTypeNames.Long) - def LongClass(implicit ctx: Context): ClassSymbol = LongType.symbol.asClass - @threadUnsafe lazy val Long_XOR_Long: Symbol = LongType.member(nme.XOR).requiredSymbol("method", nme.XOR, LongType.denot)( - x => x.is(Method) && (x.info.firstParamTypes.head isRef defn.LongClass) - ) - @threadUnsafe lazy val Long_LSR_Int: Symbol = LongType.member(nme.LSR).requiredSymbol("method", nme.LSR, LongType.denot)( - x => x.is(Method) && (x.info.firstParamTypes.head isRef defn.IntClass) - ) - @threadUnsafe lazy val Long_plusR: TermRef = LongClass.requiredMethodRef(nme.PLUS, List(LongType)) - def Long_+ : Symbol = Long_plusR.symbol - @threadUnsafe lazy val Long_mulR: TermRef = LongClass.requiredMethodRef(nme.MUL, List(LongType)) - def Long_* : Symbol = Long_mulR.symbol - @threadUnsafe lazy val Long_divR: TermRef = LongClass.requiredMethodRef(nme.DIV, List(LongType)) - def Long_/ : Symbol = Long_divR.symbol + def LongClass given Context: ClassSymbol = LongType.symbol.asClass + @threadUnsafe lazy val Long_+ : Symbol = LongClass.requiredMethod(nme.PLUS, List(LongType)) + @threadUnsafe lazy val Long_* : Symbol = LongClass.requiredMethod(nme.MUL, List(LongType)) + @threadUnsafe lazy val Long_/ : Symbol = LongClass.requiredMethod(nme.DIV, List(LongType)) @threadUnsafe lazy val FloatType: TypeRef = valueTypeRef("scala.Float", java.lang.Float.TYPE, FloatEnc, nme.specializedTypeNames.Float) - def FloatClass(implicit ctx: Context): ClassSymbol = FloatType.symbol.asClass + def FloatClass given Context: ClassSymbol = FloatType.symbol.asClass @threadUnsafe lazy val DoubleType: TypeRef = valueTypeRef("scala.Double", java.lang.Double.TYPE, DoubleEnc, nme.specializedTypeNames.Double) - def DoubleClass(implicit ctx: Context): ClassSymbol = DoubleType.symbol.asClass - - @threadUnsafe lazy val BoxedUnitType: TypeRef = ctx.requiredClassRef("scala.runtime.BoxedUnit") - def BoxedUnitClass(implicit ctx: Context): ClassSymbol = BoxedUnitType.symbol.asClass - - def BoxedUnit_UNIT(implicit ctx: Context): TermSymbol = BoxedUnitClass.linkedClass.requiredValue("UNIT") - - @threadUnsafe lazy val BoxedBooleanType: TypeRef = ctx.requiredClassRef("java.lang.Boolean") - def BoxedBooleanClass(implicit ctx: Context): ClassSymbol = BoxedBooleanType.symbol.asClass - @threadUnsafe lazy val BoxedByteType: TypeRef = ctx.requiredClassRef("java.lang.Byte") - def BoxedByteClass(implicit ctx: Context): ClassSymbol = BoxedByteType.symbol.asClass - @threadUnsafe lazy val BoxedShortType: TypeRef = ctx.requiredClassRef("java.lang.Short") - def BoxedShortClass(implicit ctx: Context): ClassSymbol = BoxedShortType.symbol.asClass - @threadUnsafe lazy val BoxedCharType: TypeRef = ctx.requiredClassRef("java.lang.Character") - def BoxedCharClass(implicit ctx: Context): ClassSymbol = BoxedCharType.symbol.asClass - @threadUnsafe lazy val BoxedIntType: TypeRef = ctx.requiredClassRef("java.lang.Integer") - def BoxedIntClass(implicit ctx: Context): ClassSymbol = BoxedIntType.symbol.asClass - @threadUnsafe lazy val BoxedLongType: TypeRef = ctx.requiredClassRef("java.lang.Long") - def BoxedLongClass(implicit ctx: Context): ClassSymbol = BoxedLongType.symbol.asClass - @threadUnsafe lazy val BoxedFloatType: TypeRef = ctx.requiredClassRef("java.lang.Float") - def BoxedFloatClass(implicit ctx: Context): ClassSymbol = BoxedFloatType.symbol.asClass - @threadUnsafe lazy val BoxedDoubleType: TypeRef = ctx.requiredClassRef("java.lang.Double") - def BoxedDoubleClass(implicit ctx: Context): ClassSymbol = BoxedDoubleType.symbol.asClass + def DoubleClass given Context: ClassSymbol = DoubleType.symbol.asClass + + @threadUnsafe lazy val BoxedUnitClass: ClassSymbol = ctx.requiredClass("scala.runtime.BoxedUnit") + def BoxedUnit_UNIT given Context: TermSymbol = BoxedUnitClass.linkedClass.requiredValue("UNIT") + + @threadUnsafe lazy val BoxedBooleanClass: ClassSymbol = ctx.requiredClass("java.lang.Boolean") + @threadUnsafe lazy val BoxedByteClass : ClassSymbol = ctx.requiredClass("java.lang.Byte") + @threadUnsafe lazy val BoxedShortClass : ClassSymbol = ctx.requiredClass("java.lang.Short") + @threadUnsafe lazy val BoxedCharClass : ClassSymbol = ctx.requiredClass("java.lang.Character") + @threadUnsafe lazy val BoxedIntClass : ClassSymbol = ctx.requiredClass("java.lang.Integer") + @threadUnsafe lazy val BoxedLongClass : ClassSymbol = ctx.requiredClass("java.lang.Long") + @threadUnsafe lazy val BoxedFloatClass : ClassSymbol = ctx.requiredClass("java.lang.Float") + @threadUnsafe lazy val BoxedDoubleClass : ClassSymbol = ctx.requiredClass("java.lang.Double") @threadUnsafe lazy val BoxedBooleanModule: TermSymbol = ctx.requiredModule("java.lang.Boolean") - @threadUnsafe lazy val BoxedByteModule: TermSymbol = ctx.requiredModule("java.lang.Byte") - @threadUnsafe lazy val BoxedShortModule: TermSymbol = ctx.requiredModule("java.lang.Short") - @threadUnsafe lazy val BoxedCharModule: TermSymbol = ctx.requiredModule("java.lang.Character") - @threadUnsafe lazy val BoxedIntModule: TermSymbol = ctx.requiredModule("java.lang.Integer") - @threadUnsafe lazy val BoxedLongModule: TermSymbol = ctx.requiredModule("java.lang.Long") - @threadUnsafe lazy val BoxedFloatModule: TermSymbol = ctx.requiredModule("java.lang.Float") - @threadUnsafe lazy val BoxedDoubleModule: TermSymbol = ctx.requiredModule("java.lang.Double") - @threadUnsafe lazy val BoxedUnitModule: TermSymbol = ctx.requiredModule("java.lang.Void") + @threadUnsafe lazy val BoxedByteModule : TermSymbol = ctx.requiredModule("java.lang.Byte") + @threadUnsafe lazy val BoxedShortModule : TermSymbol = ctx.requiredModule("java.lang.Short") + @threadUnsafe lazy val BoxedCharModule : TermSymbol = ctx.requiredModule("java.lang.Character") + @threadUnsafe lazy val BoxedIntModule : TermSymbol = ctx.requiredModule("java.lang.Integer") + @threadUnsafe lazy val BoxedLongModule : TermSymbol = ctx.requiredModule("java.lang.Long") + @threadUnsafe lazy val BoxedFloatModule : TermSymbol = ctx.requiredModule("java.lang.Float") + @threadUnsafe lazy val BoxedDoubleModule : TermSymbol = ctx.requiredModule("java.lang.Double") + @threadUnsafe lazy val BoxedUnitModule : TermSymbol = ctx.requiredModule("java.lang.Void") @threadUnsafe lazy val ByNameParamClass2x: ClassSymbol = enterSpecialPolyClass(tpnme.BYNAME_PARAM_CLASS, Covariant, Seq(AnyType)) @threadUnsafe lazy val RepeatedParamClass: ClassSymbol = enterSpecialPolyClass(tpnme.REPEATED_PARAM_CLASS, Covariant, Seq(ObjectType, SeqType)) // fundamental classes - @threadUnsafe lazy val StringClass: ClassSymbol = ctx.requiredClass("java.lang.String") - def StringType: Type = StringClass.typeRef - @threadUnsafe lazy val StringModule: Symbol = StringClass.linkedClass - + @threadUnsafe lazy val StringClass: ClassSymbol = ctx.requiredClass("java.lang.String") + def StringType: Type = StringClass.typeRef + @threadUnsafe lazy val StringModule: Symbol = StringClass.linkedClass @threadUnsafe lazy val String_+ : TermSymbol = enterMethod(StringClass, nme.raw.PLUS, methOfAny(StringType), Final) @threadUnsafe lazy val String_valueOf_Object: Symbol = StringModule.info.member(nme.valueOf).suchThat(_.info.firstParamTypes match { case List(pt) => (pt isRef AnyClass) || (pt isRef ObjectClass) @@ -616,12 +547,13 @@ class Definitions { // in scalac modified to have Any as parent @threadUnsafe lazy val ThrowableType: TypeRef = ctx.requiredClassRef("java.lang.Throwable") - def ThrowableClass(implicit ctx: Context): ClassSymbol = ThrowableType.symbol.asClass + def ThrowableClass given Context: ClassSymbol = ThrowableType.symbol.asClass @threadUnsafe lazy val SerializableType: TypeRef = if (isNewCollections) JavaSerializableClass.typeRef else ctx.requiredClassRef("scala.Serializable") + def SerializableClass given Context: ClassSymbol = SerializableType.symbol.asClass @threadUnsafe lazy val JavaEnumClass: ClassSymbol = { val cls = ctx.requiredClass("java.lang.Enum") @@ -649,205 +581,122 @@ class Definitions { } def JavaEnumType = JavaEnumClass.typeRef - def SerializableClass(implicit ctx: Context): ClassSymbol = SerializableType.symbol.asClass - @threadUnsafe lazy val StringBuilderType: TypeRef = ctx.requiredClassRef("scala.collection.mutable.StringBuilder") - def StringBuilderClass(implicit ctx: Context): ClassSymbol = StringBuilderType.symbol.asClass - @threadUnsafe lazy val MatchErrorType: TypeRef = ctx.requiredClassRef("scala.MatchError") - def MatchErrorClass(implicit ctx: Context): ClassSymbol = MatchErrorType.symbol.asClass - @threadUnsafe lazy val ConversionType: TypeRef = ctx.requiredClass("scala.Conversion").typeRef - def ConversionClass(implicit ctx: Context): ClassSymbol = ConversionType.symbol.asClass - - @threadUnsafe lazy val StringAddType: TypeRef = ctx.requiredClassRef("scala.runtime.StringAdd") - def StringAddClass(implicit ctx: Context): ClassSymbol = StringAddType.symbol.asClass - - @threadUnsafe lazy val StringAdd_plusR: TermRef = StringAddClass.requiredMethodRef(nme.raw.PLUS) - def StringAdd_+(implicit ctx: Context): Symbol = StringAdd_plusR.symbol - - @threadUnsafe lazy val StringContextType: TypeRef = ctx.requiredClassRef("scala.StringContext") - def StringContextClass(implicit ctx: Context): ClassSymbol = StringContextType.symbol.asClass - @threadUnsafe lazy val StringContextSR: TermRef = StringContextClass.requiredMethodRef(nme.s) - def StringContextS(implicit ctx: Context): Symbol = StringContextSR.symbol - @threadUnsafe lazy val StringContextRawR: TermRef = StringContextClass.requiredMethodRef(nme.raw_) - def StringContextRaw(implicit ctx: Context): Symbol = StringContextRawR.symbol - @threadUnsafe lazy val StringContext_fR: TermRef = StringContextClass.requiredMethodRef(nme.f) - def StringContext_f(implicit ctx: Context): Symbol = StringContext_fR.symbol - def StringContextModule(implicit ctx: Context): Symbol = StringContextClass.companionModule - @threadUnsafe lazy val StringContextModule_applyR: TermRef = StringContextModule.requiredMethodRef(nme.apply) - def StringContextModule_apply(implicit ctx: Context): Symbol = StringContextModule_applyR.symbol - - @threadUnsafe lazy val InternalStringContextMacroModuleR: TermRef = ctx.requiredModuleRef("dotty.internal.StringContextMacro") - def InternalStringContextMacroModule(implicit ctx: Context): Symbol = InternalStringContextMacroModuleR.termSymbol - @threadUnsafe lazy val InternalStringContextMacroModule_fR: TermRef = InternalStringContextMacroModule.requiredMethodRef(nme.f) - def InternalStringContextMacroModule_f(implicit ctx: Context): Symbol = InternalStringContextMacroModule_fR.symbol - - @threadUnsafe lazy val PartialFunctionType: TypeRef = ctx.requiredClassRef("scala.PartialFunction") - def PartialFunctionClass(implicit ctx: Context): ClassSymbol = PartialFunctionType.symbol.asClass - @threadUnsafe lazy val PartialFunction_isDefinedAtR: TermRef = PartialFunctionClass.requiredMethodRef(nme.isDefinedAt) - def PartialFunction_isDefinedAt(implicit ctx: Context): Symbol = PartialFunction_isDefinedAtR.symbol - @threadUnsafe lazy val PartialFunction_applyOrElseR: TermRef = PartialFunctionClass.requiredMethodRef(nme.applyOrElse) - def PartialFunction_applyOrElse(implicit ctx: Context): Symbol = PartialFunction_applyOrElseR.symbol - - @threadUnsafe lazy val AbstractPartialFunctionType: TypeRef = ctx.requiredClassRef("scala.runtime.AbstractPartialFunction") - def AbstractPartialFunctionClass(implicit ctx: Context): ClassSymbol = AbstractPartialFunctionType.symbol.asClass - - @threadUnsafe lazy val FunctionXXLType: TypeRef = ctx.requiredClassRef("scala.FunctionXXL") - def FunctionXXLClass(implicit ctx: Context): ClassSymbol = FunctionXXLType.symbol.asClass - - @threadUnsafe lazy val ScalaSymbolType: TypeRef = ctx.requiredClassRef("scala.Symbol") - def ScalaSymbolClass(implicit ctx: Context): ClassSymbol = ScalaSymbolType.symbol.asClass - - @threadUnsafe lazy val DynamicType: TypeRef = ctx.requiredClassRef("scala.Dynamic") - def DynamicClass(implicit ctx: Context): ClassSymbol = DynamicType.symbol.asClass - @threadUnsafe lazy val OptionType: TypeRef = ctx.requiredClassRef("scala.Option") - def OptionClass(implicit ctx: Context): ClassSymbol = OptionType.symbol.asClass - @threadUnsafe lazy val SomeType: TypeRef = ctx.requiredClassRef("scala.Some") - def SomeClass(implicit ctx: Context): ClassSymbol = SomeType.symbol.asClass - @threadUnsafe lazy val NoneModuleRef: TermRef = ctx.requiredModuleRef("scala.None") - def NoneClass(implicit ctx: Context): ClassSymbol = NoneModuleRef.symbol.moduleClass.asClass - @threadUnsafe lazy val EnumType: TypeRef = ctx.requiredClassRef("scala.Enum") - def EnumClass(implicit ctx: Context): ClassSymbol = EnumType.symbol.asClass - @threadUnsafe lazy val Enum_ordinalR: TermRef = EnumClass.requiredMethodRef(nme.ordinal) - def Enum_ordinal(implicit ctx: Context): Symbol = Enum_ordinalR.symbol - @threadUnsafe lazy val EnumValuesType: TypeRef = ctx.requiredClassRef("scala.runtime.EnumValues") - def EnumValuesClass(implicit ctx: Context): ClassSymbol = EnumValuesType.symbol.asClass - @threadUnsafe lazy val ProductType: TypeRef = ctx.requiredClassRef("scala.Product") - def ProductClass(implicit ctx: Context): ClassSymbol = ProductType.symbol.asClass - @threadUnsafe lazy val Product_canEqualR: TermRef = ProductClass.requiredMethodRef(nme.canEqual_) - def Product_canEqual(implicit ctx: Context): Symbol = Product_canEqualR.symbol - @threadUnsafe lazy val Product_productArityR: TermRef = ProductClass.requiredMethodRef(nme.productArity) - def Product_productArity(implicit ctx: Context): Symbol = Product_productArityR.symbol - @threadUnsafe lazy val Product_productElementR: TermRef = ProductClass.requiredMethodRef(nme.productElement) - def Product_productElement(implicit ctx: Context): Symbol = Product_productElementR.symbol - @threadUnsafe lazy val Product_productPrefixR: TermRef = ProductClass.requiredMethodRef(nme.productPrefix) - def Product_productPrefix(implicit ctx: Context): Symbol = Product_productPrefixR.symbol - - @threadUnsafe lazy val IteratorType: TypeRef = ctx.requiredClassRef("scala.collection.Iterator") - def IteratorClass(implicit ctx: Context): ClassSymbol = IteratorType.symbol.asClass + @threadUnsafe lazy val StringBuilderClass: ClassSymbol = ctx.requiredClass("scala.collection.mutable.StringBuilder") + @threadUnsafe lazy val MatchErrorClass : ClassSymbol = ctx.requiredClass("scala.MatchError") + @threadUnsafe lazy val ConversionClass : ClassSymbol = ctx.requiredClass("scala.Conversion") + + @threadUnsafe lazy val StringAddClass : ClassSymbol = ctx.requiredClass("scala.runtime.StringAdd") + @threadUnsafe lazy val StringAdd_+ : Symbol = StringAddClass.requiredMethod(nme.raw.PLUS) + + @threadUnsafe lazy val StringContextClass: ClassSymbol = ctx.requiredClass("scala.StringContext") + @threadUnsafe lazy val StringContextS : Symbol = StringContextClass.requiredMethod(nme.s) + @threadUnsafe lazy val StringContextRaw: Symbol = StringContextClass.requiredMethod(nme.raw_) + @threadUnsafe lazy val StringContext_f : Symbol = StringContextClass.requiredMethod(nme.f) + @threadUnsafe lazy val StringContextModule: Symbol = StringContextClass.companionModule + @threadUnsafe lazy val StringContextModule_apply: Symbol = StringContextModule.requiredMethod(nme.apply) + + @threadUnsafe lazy val InternalStringContextMacroModule: Symbol = ctx.requiredModule("dotty.internal.StringContextMacro") + @threadUnsafe lazy val InternalStringContextMacroModule_f: Symbol = InternalStringContextMacroModule.requiredMethod(nme.f) + + @threadUnsafe lazy val PartialFunctionClass: ClassSymbol = ctx.requiredClass("scala.PartialFunction") + @threadUnsafe lazy val PartialFunction_isDefinedAt: Symbol = PartialFunctionClass.requiredMethod(nme.isDefinedAt) + @threadUnsafe lazy val PartialFunction_applyOrElse: Symbol = PartialFunctionClass.requiredMethod(nme.applyOrElse) + + @threadUnsafe lazy val AbstractPartialFunctionClass: ClassSymbol = ctx.requiredClass("scala.runtime.AbstractPartialFunction") + @threadUnsafe lazy val FunctionXXLClass: ClassSymbol = ctx.requiredClass("scala.FunctionXXL") + @threadUnsafe lazy val ScalaSymbolClass: ClassSymbol = ctx.requiredClass("scala.Symbol") + @threadUnsafe lazy val DynamicClass: ClassSymbol = ctx.requiredClass("scala.Dynamic") + @threadUnsafe lazy val OptionClass: ClassSymbol = ctx.requiredClass("scala.Option") + @threadUnsafe lazy val SomeClass: ClassSymbol = ctx.requiredClass("scala.Some") + @threadUnsafe lazy val NoneModule: Symbol = ctx.requiredModule("scala.None") + + @threadUnsafe lazy val EnumClass: ClassSymbol = ctx.requiredClass("scala.Enum") + @threadUnsafe lazy val Enum_ordinal: Symbol = EnumClass.requiredMethod(nme.ordinal) + + @threadUnsafe lazy val EnumValuesClass: ClassSymbol = ctx.requiredClass("scala.runtime.EnumValues") + @threadUnsafe lazy val ProductClass: ClassSymbol = ctx.requiredClass("scala.Product") + @threadUnsafe lazy val Product_canEqual : Symbol = ProductClass.requiredMethod(nme.canEqual_) + @threadUnsafe lazy val Product_productArity : Symbol = ProductClass.requiredMethod(nme.productArity) + @threadUnsafe lazy val Product_productElement: Symbol = ProductClass.requiredMethod(nme.productElement) + @threadUnsafe lazy val Product_productPrefix : Symbol = ProductClass.requiredMethod(nme.productPrefix) + + @threadUnsafe lazy val IteratorClass: ClassSymbol = ctx.requiredClass("scala.collection.Iterator") def IteratorModule(implicit ctx: Context): Symbol = IteratorClass.companionModule - @threadUnsafe lazy val ModuleSerializationProxyType: TypeRef = ctx.requiredClassRef("scala.runtime.ModuleSerializationProxy") - def ModuleSerializationProxyClass(implicit ctx: Context): ClassSymbol = ModuleSerializationProxyType.symbol.asClass + @threadUnsafe lazy val ModuleSerializationProxyClass: ClassSymbol = ctx.requiredClass("scala.runtime.ModuleSerializationProxy") @threadUnsafe lazy val ModuleSerializationProxyConstructor: TermSymbol = ModuleSerializationProxyClass.requiredMethod(nme.CONSTRUCTOR, List(ClassType(TypeBounds.empty))) - @threadUnsafe lazy val MirrorType: TypeRef = ctx.requiredClassRef("scala.deriving.Mirror") - def MirrorClass(implicit ctx: Context): ClassSymbol = MirrorType.symbol.asClass - - @threadUnsafe lazy val Mirror_ProductType: TypeRef = ctx.requiredClassRef("scala.deriving.Mirror.Product") - def Mirror_ProductClass(implicit ctx: Context): ClassSymbol = Mirror_ProductType.symbol.asClass - - @threadUnsafe lazy val Mirror_Product_fromProductR: TermRef = Mirror_ProductClass.requiredMethodRef(nme.fromProduct) - def Mirror_Product_fromProduct(implicit ctx: Context): Symbol = Mirror_Product_fromProductR.symbol + @threadUnsafe lazy val MirrorClass: ClassSymbol = ctx.requiredClass("scala.deriving.Mirror") + @threadUnsafe lazy val Mirror_ProductClass: ClassSymbol = ctx.requiredClass("scala.deriving.Mirror.Product") + @threadUnsafe lazy val Mirror_Product_fromProduct: Symbol = Mirror_ProductClass.requiredMethod(nme.fromProduct) + @threadUnsafe lazy val Mirror_SumClass: ClassSymbol = ctx.requiredClass("scala.deriving.Mirror.Sum") + @threadUnsafe lazy val Mirror_SingletonClass: ClassSymbol = ctx.requiredClass("scala.deriving.Mirror.Singleton") + @threadUnsafe lazy val Mirror_SingletonProxyClass: ClassSymbol = ctx.requiredClass("scala.deriving.Mirror.SingletonProxy") - @threadUnsafe lazy val Mirror_SumType: TypeRef = ctx.requiredClassRef("scala.deriving.Mirror.Sum") - def Mirror_SumClass(implicit ctx: Context): ClassSymbol = Mirror_SumType.symbol.asClass + @threadUnsafe lazy val LanguageModule: Symbol = ctx.requiredModule("scala.language") + @threadUnsafe lazy val NonLocalReturnControlClass: ClassSymbol = ctx.requiredClass("scala.runtime.NonLocalReturnControl") + @threadUnsafe lazy val SelectableClass: ClassSymbol = ctx.requiredClass("scala.Selectable") - @threadUnsafe lazy val Mirror_SingletonType: TypeRef = ctx.requiredClassRef("scala.deriving.Mirror.Singleton") - def Mirror_SingletonClass(implicit ctx: Context): ClassSymbol = Mirror_SingletonType.symbol.asClass + @threadUnsafe lazy val ClassTagClass: ClassSymbol = ctx.requiredClass("scala.reflect.ClassTag") + @threadUnsafe lazy val ClassTagModule: Symbol = ClassTagClass.companionModule + @threadUnsafe lazy val ClassTagModule_apply: Symbol = ClassTagModule.requiredMethod(nme.apply) - @threadUnsafe lazy val Mirror_SingletonProxyType: TypeRef = ctx.requiredClassRef("scala.deriving.Mirror.SingletonProxy") - def Mirror_SingletonProxyClass(implicit ctx: Context): ClassSymbol = Mirror_SingletonProxyType.symbol.asClass + @threadUnsafe lazy val QuotedExprClass: ClassSymbol = ctx.requiredClass("scala.quoted.Expr") + @threadUnsafe lazy val QuotedExprModule: Symbol = QuotedExprClass.companionModule - @threadUnsafe lazy val LanguageModuleRef: TermSymbol = ctx.requiredModule("scala.language") - def LanguageModuleClass(implicit ctx: Context): ClassSymbol = LanguageModuleRef.moduleClass.asClass - @threadUnsafe lazy val NonLocalReturnControlType: TypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl") - @threadUnsafe lazy val SelectableType: TypeRef = ctx.requiredClassRef("scala.Selectable") + @threadUnsafe lazy val QuoteContextClass: ClassSymbol = ctx.requiredClass("scala.quoted.QuoteContext") + @threadUnsafe lazy val QuoteContextModule: Symbol = QuoteContextClass.companionModule + @threadUnsafe lazy val QuoteContext_macroContext: Symbol = QuoteContextModule.requiredMethod("macroContext") - @threadUnsafe 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 - @threadUnsafe lazy val ClassTagModule_applyR: TermRef = ClassTagModule.requiredMethodRef(nme.apply) - def ClassTagModule_apply(implicit ctx: Context): Symbol = ClassTagModule_applyR.symbol + @threadUnsafe lazy val LiftableModule: Symbol = ctx.requiredModule("scala.quoted.Liftable") - @threadUnsafe 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 - - @threadUnsafe lazy val QuoteContextType: TypeRef = ctx.requiredClassRef("scala.quoted.QuoteContext") - def QuoteContextClass(implicit ctx: Context): ClassSymbol = QuoteContextType.symbol.asClass - - @threadUnsafe lazy val QuoteContextModule: TermSymbol = ctx.requiredModule("scala.quoted.QuoteContext") - @threadUnsafe lazy val QuoteContext_macroContext: TermSymbol = QuoteContextModule.requiredMethod("macroContext") - - @threadUnsafe lazy val LiftableModule: TermSymbol = ctx.requiredModule("scala.quoted.Liftable") - - @threadUnsafe lazy val InternalQuotedModuleRef: TermRef = ctx.requiredModuleRef("scala.internal.Quoted") - def InternalQuotedModule: Symbol = InternalQuotedModuleRef.symbol - @threadUnsafe lazy val InternalQuoted_exprQuoteR: TermRef = InternalQuotedModule.requiredMethodRef("exprQuote") - def InternalQuoted_exprQuote(implicit ctx: Context): Symbol = InternalQuoted_exprQuoteR.symbol - @threadUnsafe lazy val InternalQuoted_exprSpliceR: TermRef = InternalQuotedModule.requiredMethodRef("exprSplice") - def InternalQuoted_exprSplice(implicit ctx: Context): Symbol = InternalQuoted_exprSpliceR.symbol - @threadUnsafe lazy val InternalQuoted_typeQuoteR: TermRef = InternalQuotedModule.requiredMethodRef("typeQuote") - def InternalQuoted_typeQuote(implicit ctx: Context): Symbol = InternalQuoted_typeQuoteR.symbol - @threadUnsafe lazy val InternalQuoted_patternHoleR: TermRef = InternalQuotedModule.requiredMethodRef("patternHole") - def InternalQuoted_patternHole(implicit ctx: Context): Symbol = InternalQuoted_patternHoleR.symbol + @threadUnsafe lazy val InternalQuotedModule: Symbol = ctx.requiredModule("scala.internal.Quoted") + @threadUnsafe lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("exprQuote") + @threadUnsafe lazy val InternalQuoted_exprSplice : Symbol = InternalQuotedModule.requiredMethod("exprSplice") + @threadUnsafe lazy val InternalQuoted_typeQuote : Symbol = InternalQuotedModule.requiredMethod("typeQuote") + @threadUnsafe lazy val InternalQuoted_patternHole: Symbol = InternalQuotedModule.requiredMethod("patternHole") @threadUnsafe lazy val InternalQuoted_patternBindHoleAnnot: ClassSymbol = InternalQuotedModule.requiredClass("patternBindHole") - @threadUnsafe lazy val InternalQuoted_QuoteTypeTagAnnot: ClassSymbol = InternalQuotedModule.requiredClass("quoteTypeTag") - - @threadUnsafe lazy val InternalQuotedMatcherModuleRef: TermRef = ctx.requiredModuleRef("scala.internal.quoted.Matcher") - def InternalQuotedMatcherModule(implicit ctx: Context): Symbol = InternalQuotedMatcherModuleRef.symbol - - @threadUnsafe lazy val InternalQuotedMatcher_unapplyR: TermRef = InternalQuotedMatcherModule.requiredMethodRef(nme.unapply) - def InternalQuotedMatcher_unapply(implicit ctx: Context) = InternalQuotedMatcher_unapplyR.symbol - - @threadUnsafe lazy val QuotedTypeType: TypeRef = ctx.requiredClassRef("scala.quoted.Type") - def QuotedTypeClass(implicit ctx: Context): ClassSymbol = QuotedTypeType.symbol.asClass - - @threadUnsafe lazy val QuotedType_spliceR: TypeRef = QuotedTypeClass.requiredType(tpnme.splice).typeRef - def QuotedType_splice : Symbol = QuotedType_spliceR.symbol - - @threadUnsafe lazy val QuotedTypeModuleRef: TermRef = ctx.requiredModuleRef("scala.quoted.Type") - def QuotedTypeModule(implicit ctx: Context): Symbol = QuotedTypeModuleRef.symbol - - @threadUnsafe lazy val QuotedMatchingBindingType: TypeRef = ctx.requiredClassRef("scala.quoted.matching.Bind") - def QuotedMatchingBindingClass(implicit ctx: Context): ClassSymbol = QuotedMatchingBindingType.symbol.asClass + @threadUnsafe lazy val InternalQuoted_QuoteTypeTagAnnot : ClassSymbol = InternalQuotedModule.requiredClass("quoteTypeTag") - def Unpickler_unpickleExpr: TermSymbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleExpr") - def Unpickler_unpickleType: TermSymbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleType") + @threadUnsafe lazy val InternalQuotedMatcherModule: Symbol = ctx.requiredModule("scala.internal.quoted.Matcher") + @threadUnsafe lazy val InternalQuotedMatcher_unapply: Symbol = InternalQuotedMatcherModule.requiredMethod(nme.unapply) - @threadUnsafe lazy val TastyReflectionType: TypeRef = ctx.requiredClassRef("scala.tasty.Reflection") - def TastyReflectionClass(implicit ctx: Context): ClassSymbol = TastyReflectionType.symbol.asClass + @threadUnsafe lazy val QuotedTypeClass: ClassSymbol = ctx.requiredClass("scala.quoted.Type") + @threadUnsafe lazy val QuotedType_splice: Symbol = QuotedTypeClass.requiredType(tpnme.splice) + @threadUnsafe lazy val QuotedTypeModule: Symbol = QuotedTypeClass.companionModule - @threadUnsafe lazy val EqlType: TypeRef = ctx.requiredClassRef("scala.Eql") - def EqlClass(implicit ctx: Context): ClassSymbol = EqlType.symbol.asClass - def EqlModule(implicit ctx: Context): Symbol = EqlClass.companionModule + @threadUnsafe lazy val QuotedMatchingBindingClass: ClassSymbol = ctx.requiredClass("scala.quoted.matching.Bind") + @threadUnsafe lazy val TastyReflectionClass: ClassSymbol = ctx.requiredClass("scala.tasty.TastyReflection") - def Eql_eqlAny(implicit ctx: Context): TermSymbol = EqlModule.requiredMethod(nme.eqlAny) + @threadUnsafe lazy val Unpickler_unpickleExpr: Symbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleExpr") + @threadUnsafe lazy val Unpickler_unpickleType: Symbol = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleType") - @threadUnsafe lazy val TypeBoxType: TypeRef = ctx.requiredClassRef("scala.internal.TypeBox") + @threadUnsafe lazy val EqlClass: ClassSymbol = ctx.requiredClass("scala.Eql") + def Eql_eqlAny(implicit ctx: Context): TermSymbol = EqlClass.companionModule.requiredMethod(nme.eqlAny) - @threadUnsafe lazy val TypeBox_CAP: TypeSymbol = TypeBoxType.symbol.requiredType(tpnme.CAP) + @threadUnsafe lazy val TypeBoxClass: ClassSymbol = ctx.requiredClass("scala.internal.TypeBox") + @threadUnsafe lazy val TypeBox_CAP: TypeSymbol = TypeBoxClass.requiredType(tpnme.CAP) - @threadUnsafe lazy val MatchCaseType: TypeRef = ctx.requiredClassRef("scala.internal.MatchCase") - def MatchCaseClass(implicit ctx: Context): ClassSymbol = MatchCaseType.symbol.asClass + @threadUnsafe lazy val MatchCaseClass: ClassSymbol = ctx.requiredClass("scala.internal.MatchCase") + @threadUnsafe lazy val NotClass: ClassSymbol = ctx.requiredClass("scala.implicits.Not") + @threadUnsafe lazy val Not_value: Symbol = NotClass.companionModule.requiredMethod(nme.value) - @threadUnsafe 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 + @threadUnsafe lazy val ValueOfClass: ClassSymbol = ctx.requiredClass("scala.ValueOf") + @threadUnsafe lazy val StatsModule: Symbol = ctx.requiredModule("dotty.tools.dotc.util.Stats") + @threadUnsafe lazy val Stats_doRecord: Symbol = StatsModule.requiredMethod("doRecord") - def Not_value(implicit ctx: Context): TermSymbol = NotModule.requiredMethod(nme.value) - - @threadUnsafe lazy val ValueOfType: TypeRef = ctx.requiredClassRef("scala.ValueOf") - def ValueOfClass(implicit ctx: Context): ClassSymbol = ValueOfType.symbol.asClass - - @threadUnsafe lazy val StatsModule = ctx.requiredModule("dotty.tools.dotc.util.Stats") - def Stats_doRecord(implicit ctx: Context): TermSymbol = StatsModule.requiredMethod("doRecord") - - @threadUnsafe lazy val XMLTopScopeModuleRef: TermRef = ctx.requiredModuleRef("scala.xml.TopScope") + @threadUnsafe lazy val XMLTopScopeModule: Symbol = ctx.requiredModule("scala.xml.TopScope") @threadUnsafe lazy val TupleTypeRef: TypeRef = ctx.requiredClassRef("scala.Tuple") def TupleClass(implicit ctx: Context): ClassSymbol = TupleTypeRef.symbol.asClass - @threadUnsafe lazy val Tuple_consR: TermRef = TupleClass.requiredMethod("*:").termRef - def Tuple_cons: Symbol = Tuple_consR.symbol + @threadUnsafe lazy val Tuple_cons: Symbol = TupleClass.requiredMethod("*:") @threadUnsafe lazy val NonEmptyTupleTypeRef: TypeRef = ctx.requiredClassRef("scala.NonEmptyTuple") def NonEmptyTupleClass(implicit ctx: Context): ClassSymbol = NonEmptyTupleTypeRef.symbol.asClass - lazy val NonEmptyTuple_tailR: TermRef = NonEmptyTupleClass.requiredMethod("tail").termRef - def NonEmptyTuple_tail: Symbol = NonEmptyTuple_tailR.symbol + lazy val NonEmptyTuple_tail: Symbol = NonEmptyTupleClass.requiredMethod("tail") - @threadUnsafe lazy val PairType: TypeRef = ctx.requiredClassRef("scala.*:") - def PairClass(implicit ctx: Context): ClassSymbol = PairType.symbol.asClass - @threadUnsafe lazy val TupleXXLType: TypeRef = ctx.requiredClassRef("scala.TupleXXL") - def TupleXXLClass(implicit ctx: Context): ClassSymbol = TupleXXLType.symbol.asClass + @threadUnsafe lazy val PairClass: ClassSymbol = ctx.requiredClass("scala.*:") + @threadUnsafe lazy val TupleXXLClass: ClassSymbol = ctx.requiredClass("scala.TupleXXL") def TupleXXLModule(implicit ctx: Context): Symbol = TupleXXLClass.companionModule def TupleXXL_apply(implicit ctx: Context): Symbol = @@ -874,100 +723,54 @@ class Definitions { def InternalTupleFunctionModule(implicit ctx: Context): Symbol = ctx.requiredModule("scala.internal.TupledFunction") // Annotation base classes - @threadUnsafe lazy val AnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.Annotation") - def AnnotationClass(implicit ctx: Context): ClassSymbol = AnnotationType.symbol.asClass - @threadUnsafe lazy val ClassfileAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation") - def ClassfileAnnotationClass(implicit ctx: Context): ClassSymbol = ClassfileAnnotationType.symbol.asClass - @threadUnsafe lazy val StaticAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.StaticAnnotation") - def StaticAnnotationClass(implicit ctx: Context): ClassSymbol = StaticAnnotationType.symbol.asClass - @threadUnsafe lazy val RefiningAnnotationType: TypeRef = ctx.requiredClassRef("scala.annotation.RefiningAnnotation") - def RefiningAnnotationClass(implicit ctx: Context): ClassSymbol = RefiningAnnotationType.symbol.asClass + @threadUnsafe lazy val AnnotationClass: ClassSymbol = ctx.requiredClass("scala.annotation.Annotation") + @threadUnsafe lazy val ClassfileAnnotationClass: ClassSymbol = ctx.requiredClass("scala.annotation.ClassfileAnnotation") + @threadUnsafe lazy val StaticAnnotationClass: ClassSymbol = ctx.requiredClass("scala.annotation.StaticAnnotation") + @threadUnsafe lazy val RefiningAnnotationClass: ClassSymbol = ctx.requiredClass("scala.annotation.RefiningAnnotation") // Annotation classes - @threadUnsafe lazy val AliasAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Alias") - def AliasAnnot(implicit ctx: Context): ClassSymbol = AliasAnnotType.symbol.asClass - @threadUnsafe lazy val AnnotationDefaultAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.AnnotationDefault") - def AnnotationDefaultAnnot(implicit ctx: Context): ClassSymbol = AnnotationDefaultAnnotType.symbol.asClass - @threadUnsafe lazy val BodyAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Body") - def BodyAnnot(implicit ctx: Context): ClassSymbol = BodyAnnotType.symbol.asClass - @threadUnsafe lazy val ChildAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Child") - def ChildAnnot(implicit ctx: Context): ClassSymbol = ChildAnnotType.symbol.asClass - @threadUnsafe lazy val WithBoundsAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.WithBounds") - def WithBoundsAnnot(implicit ctx: Context): ClassSymbol = WithBoundsAnnotType.symbol.asClass - @threadUnsafe lazy val CovariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.CovariantBetween") - def CovariantBetweenAnnot(implicit ctx: Context): ClassSymbol = CovariantBetweenAnnotType.symbol.asClass - @threadUnsafe lazy val ContravariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.ContravariantBetween") - def ContravariantBetweenAnnot(implicit ctx: Context): ClassSymbol = ContravariantBetweenAnnotType.symbol.asClass - @threadUnsafe lazy val DeprecatedAnnotType: TypeRef = ctx.requiredClassRef("scala.deprecated") - def DeprecatedAnnot(implicit ctx: Context): ClassSymbol = DeprecatedAnnotType.symbol.asClass - @threadUnsafe lazy val ImplicitAmbiguousAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.implicitAmbiguous") - def ImplicitAmbiguousAnnot(implicit ctx: Context): ClassSymbol = ImplicitAmbiguousAnnotType.symbol.asClass - @threadUnsafe lazy val ImplicitNotFoundAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.implicitNotFound") - def ImplicitNotFoundAnnot(implicit ctx: Context): ClassSymbol = ImplicitNotFoundAnnotType.symbol.asClass - @threadUnsafe lazy val ForceInlineAnnotType: TypeRef = ctx.requiredClassRef("scala.forceInline") - def ForceInlineAnnot(implicit ctx: Context): ClassSymbol = ForceInlineAnnotType.symbol.asClass - @threadUnsafe lazy val InlineParamAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.InlineParam") - def InlineParamAnnot(implicit ctx: Context): ClassSymbol = InlineParamAnnotType.symbol.asClass - @threadUnsafe lazy val InvariantBetweenAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.InvariantBetween") - def InvariantBetweenAnnot(implicit ctx: Context): ClassSymbol = InvariantBetweenAnnotType.symbol.asClass - @threadUnsafe lazy val MigrationAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.migration") - def MigrationAnnot(implicit ctx: Context): ClassSymbol = MigrationAnnotType.symbol.asClass - @threadUnsafe lazy val NativeAnnotType: TypeRef = ctx.requiredClassRef("scala.native") - def NativeAnnot(implicit ctx: Context): ClassSymbol = NativeAnnotType.symbol.asClass - @threadUnsafe lazy val RepeatedAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.Repeated") - def RepeatedAnnot(implicit ctx: Context): ClassSymbol = RepeatedAnnotType.symbol.asClass - @threadUnsafe lazy val SourceFileAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.SourceFile") - def SourceFileAnnot(implicit ctx: Context): ClassSymbol = SourceFileAnnotType.symbol.asClass - @threadUnsafe lazy val ScalaSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.reflect.ScalaSignature") - def ScalaSignatureAnnot(implicit ctx: Context): ClassSymbol = ScalaSignatureAnnotType.symbol.asClass - @threadUnsafe lazy val ScalaLongSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.reflect.ScalaLongSignature") - def ScalaLongSignatureAnnot(implicit ctx: Context): ClassSymbol = ScalaLongSignatureAnnotType.symbol.asClass - @threadUnsafe lazy val ScalaStrictFPAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.strictfp") - def ScalaStrictFPAnnot(implicit ctx: Context): ClassSymbol = ScalaStrictFPAnnotType.symbol.asClass - @threadUnsafe lazy val ScalaStaticAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.static") - def ScalaStaticAnnot(implicit ctx: Context): ClassSymbol = ScalaStaticAnnotType.symbol.asClass - @threadUnsafe lazy val SerialVersionUIDAnnotType: TypeRef = ctx.requiredClassRef("scala.SerialVersionUID") - def SerialVersionUIDAnnot(implicit ctx: Context): ClassSymbol = SerialVersionUIDAnnotType.symbol.asClass - @threadUnsafe lazy val TASTYSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.TASTYSignature") - def TASTYSignatureAnnot(implicit ctx: Context): ClassSymbol = TASTYSignatureAnnotType.symbol.asClass - @threadUnsafe lazy val TASTYLongSignatureAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.internal.TASTYLongSignature") - def TASTYLongSignatureAnnot(implicit ctx: Context): ClassSymbol = TASTYLongSignatureAnnotType.symbol.asClass - @threadUnsafe lazy val TailrecAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.tailrec") - def TailrecAnnot(implicit ctx: Context): ClassSymbol = TailrecAnnotType.symbol.asClass - @threadUnsafe lazy val ThreadUnsafeAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.threadUnsafe") - def ThreadUnsafeAnnot(implicit ctx: Context): ClassSymbol = ThreadUnsafeAnnotType.symbol.asClass - @threadUnsafe lazy val TransientParamAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.constructorOnly") - def TransientParamAnnot(implicit ctx: Context): ClassSymbol = TransientParamAnnotType.symbol.asClass - @threadUnsafe lazy val CompileTimeOnlyAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.compileTimeOnly") - def CompileTimeOnlyAnnot(implicit ctx: Context): ClassSymbol = CompileTimeOnlyAnnotType.symbol.asClass - @threadUnsafe lazy val SwitchAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.switch") - def SwitchAnnot(implicit ctx: Context): ClassSymbol = SwitchAnnotType.symbol.asClass - @threadUnsafe lazy val ThrowsAnnotType: TypeRef = ctx.requiredClassRef("scala.throws") - def ThrowsAnnot(implicit ctx: Context): ClassSymbol = ThrowsAnnotType.symbol.asClass - @threadUnsafe lazy val TransientAnnotType: TypeRef = ctx.requiredClassRef("scala.transient") - def TransientAnnot(implicit ctx: Context): ClassSymbol = TransientAnnotType.symbol.asClass - @threadUnsafe lazy val UncheckedAnnotType: TypeRef = ctx.requiredClassRef("scala.unchecked") - def UncheckedAnnot(implicit ctx: Context): ClassSymbol = UncheckedAnnotType.symbol.asClass - @threadUnsafe lazy val UncheckedStableAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedStable") - def UncheckedStableAnnot(implicit ctx: Context): ClassSymbol = UncheckedStableAnnotType.symbol.asClass - @threadUnsafe lazy val UncheckedVarianceAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedVariance") - def UncheckedVarianceAnnot(implicit ctx: Context): ClassSymbol = UncheckedVarianceAnnotType.symbol.asClass - @threadUnsafe lazy val VolatileAnnotType: TypeRef = ctx.requiredClassRef("scala.volatile") - def VolatileAnnot(implicit ctx: Context): ClassSymbol = VolatileAnnotType.symbol.asClass - @threadUnsafe lazy val FieldMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.field") - def FieldMetaAnnot(implicit ctx: Context): ClassSymbol = FieldMetaAnnotType.symbol.asClass - @threadUnsafe lazy val GetterMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.getter") - def GetterMetaAnnot(implicit ctx: Context): ClassSymbol = GetterMetaAnnotType.symbol.asClass - @threadUnsafe lazy val SetterMetaAnnotType: TypeRef = ctx.requiredClassRef("scala.annotation.meta.setter") - def SetterMetaAnnot(implicit ctx: Context): ClassSymbol = SetterMetaAnnotType.symbol.asClass - @threadUnsafe lazy val ShowAsInfixAnotType: TypeRef = ctx.requiredClassRef("scala.annotation.showAsInfix") - def ShowAsInfixAnnot(implicit ctx: Context): ClassSymbol = ShowAsInfixAnotType.symbol.asClass - @threadUnsafe lazy val FunctionalInterfaceAnnotType = ctx.requiredClassRef("java.lang.FunctionalInterface") - def FunctionalInterfaceAnnot(implicit ctx: Context) = FunctionalInterfaceAnnotType.symbol.asClass - @threadUnsafe lazy val InfixAnnotType = ctx.requiredClassRef("scala.annotation.infix") - def InfixAnnot(implicit ctx: Context) = InfixAnnotType.symbol.asClass - @threadUnsafe lazy val AlphaAnnotType = ctx.requiredClassRef("scala.annotation.alpha") - def AlphaAnnot(implicit ctx: Context) = AlphaAnnotType.symbol.asClass + @threadUnsafe lazy val AliasAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.Alias") + @threadUnsafe lazy val AnnotationDefaultAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.AnnotationDefault") + @threadUnsafe lazy val BodyAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.Body") + @threadUnsafe lazy val ChildAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.Child") + @threadUnsafe lazy val WithBoundsAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.WithBounds") + @threadUnsafe lazy val CovariantBetweenAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.CovariantBetween") + @threadUnsafe lazy val ContravariantBetweenAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.ContravariantBetween") + @threadUnsafe lazy val DeprecatedAnnot: ClassSymbol = ctx.requiredClass("scala.deprecated") + @threadUnsafe lazy val ImplicitAmbiguousAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.implicitAmbiguous") + @threadUnsafe lazy val ImplicitNotFoundAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.implicitNotFound") + @threadUnsafe lazy val ForceInlineAnnot: ClassSymbol = ctx.requiredClass("scala.forceInline") + @threadUnsafe lazy val InlineParamAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.InlineParam") + @threadUnsafe lazy val InvariantBetweenAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.InvariantBetween") + @threadUnsafe lazy val MigrationAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.migration") + @threadUnsafe lazy val NativeAnnot: ClassSymbol = ctx.requiredClass("scala.native") + @threadUnsafe lazy val RepeatedAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.Repeated") + @threadUnsafe lazy val SourceFileAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.SourceFile") + @threadUnsafe lazy val ScalaSignatureAnnot: ClassSymbol = ctx.requiredClass("scala.reflect.ScalaSignature") + @threadUnsafe lazy val ScalaLongSignatureAnnot: ClassSymbol = ctx.requiredClass("scala.reflect.ScalaLongSignature") + @threadUnsafe lazy val ScalaStrictFPAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.strictfp") + @threadUnsafe lazy val ScalaStaticAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.static") + @threadUnsafe lazy val SerialVersionUIDAnnot: ClassSymbol = ctx.requiredClass("scala.SerialVersionUID") + @threadUnsafe lazy val TASTYSignatureAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.TASTYSignature") + @threadUnsafe lazy val TASTYLongSignatureAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.internal.TASTYLongSignature") + @threadUnsafe lazy val TailrecAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.tailrec") + @threadUnsafe lazy val ThreadUnsafeAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.threadUnsafe") + @threadUnsafe lazy val TransientParamAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.constructorOnly") + @threadUnsafe lazy val CompileTimeOnlyAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.compileTimeOnly") + @threadUnsafe lazy val SwitchAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.switch") + @threadUnsafe lazy val ThrowsAnnot: ClassSymbol = ctx.requiredClass("scala.throws") + @threadUnsafe lazy val TransientAnnot: ClassSymbol = ctx.requiredClass("scala.transient") + @threadUnsafe lazy val UncheckedAnnot: ClassSymbol = ctx.requiredClass("scala.unchecked") + @threadUnsafe lazy val UncheckedStableAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.unchecked.uncheckedStable") + @threadUnsafe lazy val UncheckedVarianceAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.unchecked.uncheckedVariance") + @threadUnsafe lazy val VolatileAnnot: ClassSymbol = ctx.requiredClass("scala.volatile") + @threadUnsafe lazy val FieldMetaAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.meta.field") + @threadUnsafe lazy val GetterMetaAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.meta.getter") + @threadUnsafe lazy val SetterMetaAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.meta.setter") + @threadUnsafe lazy val ShowAsInfixAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.showAsInfix") + @threadUnsafe lazy val FunctionalInterfaceAnnot: ClassSymbol = ctx.requiredClass("java.lang.FunctionalInterface") + @threadUnsafe lazy val InfixAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.infix") + @threadUnsafe lazy val AlphaAnnot: ClassSymbol = ctx.requiredClass("scala.annotation.alpha") // convenient one-parameter method types def methOfAny(tp: Type): MethodType = MethodType(List(AnyType), tp) @@ -1007,7 +810,7 @@ class Definitions { object PartialFunctionOf { def apply(arg: Type, result: Type)(implicit ctx: Context): Type = - PartialFunctionType.appliedTo(arg :: result :: Nil) + PartialFunctionClass.typeRef.appliedTo(arg :: result :: Nil) def unapply(pft: Type)(implicit ctx: Context): Option[(Type, List[Type])] = { if (pft.isRef(PartialFunctionClass)) { val targs = pft.dealias.argInfos @@ -1029,7 +832,7 @@ class Definitions { object MatchCase { def apply(pat: Type, body: Type)(implicit ctx: Context): Type = - MatchCaseType.appliedTo(pat, body) + MatchCaseClass.typeRef.appliedTo(pat, body) def unapply(tp: Type)(implicit ctx: Context): Option[(Type, Type)] = tp match { case AppliedType(tycon, pat :: body :: Nil) if tycon.isRef(MatchCaseClass) => Some((pat, body)) @@ -1071,17 +874,16 @@ class Definitions { } final def isCompiletime_S(sym: Symbol)(implicit ctx: Context): Boolean = - sym.name == tpnme.S && sym.owner == CompiletimePackageObject + sym.name == tpnme.S && sym.owner == CompiletimePackageObject.moduleClass // ----- Symbol sets --------------------------------------------------- - @threadUnsafe lazy val AbstractFunctionType: Array[TypeRef] = mkArityArray("scala.runtime.AbstractFunction", MaxImplementedFunctionArity, 0) - val AbstractFunctionClassPerRun: PerRun[Array[Symbol]] = new PerRun(implicit ctx => AbstractFunctionType.map(_.symbol.asClass)) - def AbstractFunctionClass(n: Int)(implicit ctx: Context): Symbol = AbstractFunctionClassPerRun()(ctx)(n) - @threadUnsafe private lazy val ImplementedFunctionType = mkArityArray("scala.Function", MaxImplementedFunctionArity, 0) - def FunctionClassPerRun: PerRun[Array[Symbol]] = new PerRun(implicit ctx => ImplementedFunctionType.map(_.symbol.asClass)) + @threadUnsafe lazy val AbstractFunctionClass: Array[Symbol] = + mkArityArray("scala.runtime.AbstractFunction", MaxImplementedFunctionArity, 0).map(_.symbol.asClass) + @threadUnsafe lazy val FunctionClass: Array[Symbol] = + mkArityArray("scala.Function", MaxImplementedFunctionArity, 0).map(_.symbol.asClass) - val LazyHolder: PerRun[Map[Symbol, Symbol]] = new PerRun({ implicit ctx => + @threadUnsafe lazy val LazyHolder: Map[Symbol, Symbol] = { def holderImpl(holderType: String) = ctx.requiredClass("scala.runtime." + holderType) Map[Symbol, Symbol]( IntClass -> holderImpl("LazyInt"), @@ -1094,7 +896,7 @@ class Definitions { ShortClass -> holderImpl("LazyShort") ) .withDefaultValue(holderImpl("LazyRef")) - }) + } @threadUnsafe lazy val TupleType: Array[TypeRef] = mkArityArray("scala.Tuple", MaxTupleArity, 1) @@ -1106,16 +908,15 @@ class Definitions { else if (isErased) ctx.requiredClass("scala.ErasedFunction" + n.toString) else if (n <= MaxImplementedFunctionArity) - FunctionClassPerRun()(ctx)(n) + FunctionClass(n) else ctx.requiredClass("scala.Function" + n.toString) - @threadUnsafe lazy val Function0_applyR: TermRef = ImplementedFunctionType(0).symbol.requiredMethodRef(nme.apply) - def Function0_apply(implicit ctx: Context): Symbol = Function0_applyR.symbol + @threadUnsafe lazy val Function0_apply: Symbol = FunctionClass(0).requiredMethod(nme.apply) def FunctionType(n: Int, isContextual: Boolean = false, isErased: Boolean = false)(implicit ctx: Context): TypeRef = - if (n <= MaxImplementedFunctionArity && (!isContextual || ctx.erasedTypes) && !isErased) ImplementedFunctionType(n) - else FunctionClass(n, isContextual, isErased).typeRef + if (n <= MaxImplementedFunctionArity && (!isContextual || ctx.erasedTypes) && !isErased) FunctionClass(n).typeRef + else FunctionClass(n, isContextual, isErased).typeRef // !!!align with FunctionClass? lazy val PolyFunctionClass = ctx.requiredClass("scala.PolyFunction") def PolyFunctionType = PolyFunctionClass.typeRef @@ -1214,7 +1015,7 @@ class Definitions { def erasedFunctionType(cls: Symbol): Type = { val arity = scalaClassName(cls).functionArity if (cls.name.isErasedFunction) FunctionType(0) - else if (arity > 22) FunctionXXLType + else if (arity > 22) FunctionXXLClass.typeRef else if (arity >= 0) FunctionType(arity) else NoType } @@ -1232,8 +1033,8 @@ class Definitions { ) val PredefImportFns: List[() => TermRef] = List[() => TermRef]( - () => ScalaPredefModuleRef, - () => DottyPredefModuleRef + () => ScalaPredefModule.termRef, + () => DottyPredefModule.termRef ) @threadUnsafe lazy val RootImportFns: List[() => TermRef] = @@ -1287,8 +1088,7 @@ class Definitions { rec(tp.stripTypeVar, Nil, bound) } - def isProductSubType(tp: Type)(implicit ctx: Context): Boolean = - tp.derivesFrom(ProductType.symbol) + def isProductSubType(tp: Type)(implicit ctx: Context): Boolean = tp.derivesFrom(ProductClass) /** Is `tp` (an alias) of either a scala.FunctionN or a scala.ImplicitFunctionN * instance? @@ -1308,39 +1108,28 @@ class Definitions { isNonRefinedFunction(tp.dropDependentRefinement) // Specialized type parameters defined for scala.Function{0,1,2}. - @threadUnsafe lazy val Function1SpecializedParamTypes: collection.Set[TypeRef] = - Set(IntType, LongType, FloatType, DoubleType) - @threadUnsafe lazy val Function2SpecializedParamTypes: collection.Set[TypeRef] = - Set(IntType, LongType, DoubleType) - @threadUnsafe lazy val Function0SpecializedReturnTypes: collection.Set[TypeRef] = - ScalaNumericValueTypeList.toSet + UnitType + BooleanType - @threadUnsafe lazy val Function1SpecializedReturnTypes: collection.Set[TypeRef] = - Set(UnitType, BooleanType, IntType, FloatType, LongType, DoubleType) - @threadUnsafe lazy val Function2SpecializedReturnTypes: collection.Set[TypeRef] = - Function1SpecializedReturnTypes - - @threadUnsafe lazy val Function1SpecializedParamClasses: PerRun[collection.Set[Symbol]] = - new PerRun(implicit ctx => Function1SpecializedParamTypes.map(_.symbol)) - @threadUnsafe lazy val Function2SpecializedParamClasses: PerRun[collection.Set[Symbol]] = - new PerRun(implicit ctx => Function2SpecializedParamTypes.map(_.symbol)) - @threadUnsafe lazy val Function0SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = - new PerRun(implicit ctx => Function0SpecializedReturnTypes.map(_.symbol)) - @threadUnsafe lazy val Function1SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = - new PerRun(implicit ctx => Function1SpecializedReturnTypes.map(_.symbol)) - @threadUnsafe lazy val Function2SpecializedReturnClasses: PerRun[collection.Set[Symbol]] = - new PerRun(implicit ctx => Function2SpecializedReturnTypes.map(_.symbol)) + @threadUnsafe lazy val Function1SpecializedParamClasses: collection.Set[Symbol] = + Set(IntType, LongType, FloatType, DoubleType).map(_.symbol) + @threadUnsafe lazy val Function2SpecializedParamClasses: collection.Set[Symbol] = + Set(IntType, LongType, DoubleType).map(_.symbol) + @threadUnsafe lazy val Function0SpecializedReturnClasses: collection.Set[Symbol] = + (ScalaNumericValueTypeList.toSet + UnitType + BooleanType).map(_.symbol) + @threadUnsafe lazy val Function1SpecializedReturnClasses: collection.Set[Symbol] = + Set(UnitType, BooleanType, IntType, FloatType, LongType, DoubleType).map(_.symbol) + @threadUnsafe lazy val Function2SpecializedReturnClasses: collection.Set[Symbol] = + Function1SpecializedReturnClasses 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) + Function0SpecializedReturnClasses.contains(retType.typeSymbol) case List(paramType0) => - Function1SpecializedParamClasses().contains(paramType0.typeSymbol) && - Function1SpecializedReturnClasses().contains(retType.typeSymbol) + Function1SpecializedParamClasses.contains(paramType0.typeSymbol) && + Function1SpecializedReturnClasses.contains(retType.typeSymbol) case List(paramType0, paramType1) => - Function2SpecializedParamClasses().contains(paramType0.typeSymbol) && - Function2SpecializedParamClasses().contains(paramType1.typeSymbol) && - Function2SpecializedReturnClasses().contains(retType.typeSymbol) + Function2SpecializedParamClasses.contains(paramType0.typeSymbol) && + Function2SpecializedParamClasses.contains(paramType1.typeSymbol) && + Function2SpecializedReturnClasses.contains(retType.typeSymbol) case _ => false }) @@ -1388,31 +1177,17 @@ class Definitions { // ----- primitive value class machinery ------------------------------------------ - /** This class would also be obviated by the implicit function type design */ - class PerRun[T](generate: Context => T) { - private[this] var current: RunId = NoRunId - private[this] var cached: T = _ - def apply()(implicit ctx: Context): T = { - if (current != ctx.runId) { - cached = generate(ctx) - current = ctx.runId - } - cached - } - } - @threadUnsafe lazy val ScalaNumericValueTypeList: List[TypeRef] = List( ByteType, ShortType, CharType, IntType, LongType, FloatType, DoubleType) @threadUnsafe private lazy val ScalaNumericValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypeList.toSet @threadUnsafe private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes + UnitType + BooleanType - val ScalaNumericValueClasses: PerRun[collection.Set[Symbol]] = new PerRun(implicit ctx => ScalaNumericValueTypes.map(_.symbol)) - val ScalaValueClasses: PerRun[collection.Set[Symbol]] = new PerRun(implicit ctx => ScalaValueTypes.map(_.symbol)) + @threadUnsafe lazy val ScalaNumericValueClasses: collection.Set[Symbol] = ScalaNumericValueTypes.map(_.symbol) + @threadUnsafe lazy val ScalaValueClasses: collection.Set[Symbol] = ScalaValueTypes.map(_.symbol) - val ScalaBoxedClasses: PerRun[collection.Set[Symbol]] = new PerRun(implicit ctx => + @threadUnsafe lazy val ScalaBoxedClasses: collection.Set[Symbol] = Set(BoxedByteClass, BoxedShortClass, BoxedCharClass, BoxedIntClass, BoxedLongClass, BoxedFloatClass, BoxedDoubleClass, BoxedUnitClass, BoxedBooleanClass) - ) private val valueTypeEnc = mutable.Map[TypeName, PrimitiveClassEnc]() private val typeTags = mutable.Map[TypeName, Name]().withDefaultValue(nme.specializedTypeNames.Object) @@ -1434,17 +1209,17 @@ class Definitions { /** The type of the boxed class corresponding to primitive value type `tp`. */ def boxedType(tp: Type)(implicit ctx: Context): TypeRef = { val cls = tp.classSymbol - if (cls eq ByteClass) BoxedByteType - else if (cls eq ShortClass) BoxedShortType - else if (cls eq CharClass) BoxedCharType - else if (cls eq IntClass) BoxedIntType - else if (cls eq LongClass) BoxedLongType - else if (cls eq FloatClass) BoxedFloatType - else if (cls eq DoubleClass) BoxedDoubleType - else if (cls eq UnitClass) BoxedUnitType - else if (cls eq BooleanClass) BoxedBooleanType + if (cls eq ByteClass) BoxedByteClass + else if (cls eq ShortClass) BoxedShortClass + else if (cls eq CharClass) BoxedCharClass + else if (cls eq IntClass) BoxedIntClass + else if (cls eq LongClass) BoxedLongClass + else if (cls eq FloatClass) BoxedFloatClass + else if (cls eq DoubleClass) BoxedDoubleClass + else if (cls eq UnitClass) BoxedUnitClass + else if (cls eq BooleanClass) BoxedBooleanClass else sys.error(s"Not a primitive value type: $tp") - } + }.typeRef /** The JVM tag for `tp` if it's a primitive, `java.lang.Object` otherwise. */ def typeTag(tp: Type)(implicit ctx: Context): Name = typeTags(scalaClassName(tp)) @@ -1510,11 +1285,11 @@ class Definitions { this.ctx = ctx if (!isInitialized) { // Enter all symbols from the scalaShadowing package in the scala package - for (m <- ScalaShadowingPackageClass.info.decls) + for (m <- ScalaShadowingPackage.info.decls) ScalaPackageClass.enter(m) // force initialization of every symbol that is synthesized or hijacked by the compiler - val forced = syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses() :+ JavaEnumClass + val forced = syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses :+ JavaEnumClass isInitialized = true } diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 045a4f2eb365..9160dec80c60 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -600,11 +600,11 @@ object SymDenotations { /** Is symbol a primitive value class? */ def isPrimitiveValueClass(implicit ctx: Context): Boolean = - maybeOwner == defn.ScalaPackageClass && defn.ScalaValueClasses().contains(symbol) + maybeOwner == defn.ScalaPackageClass && defn.ScalaValueClasses.contains(symbol) /** Is symbol a primitive numeric value class? */ def isNumericValueClass(implicit ctx: Context): Boolean = - maybeOwner == defn.ScalaPackageClass && defn.ScalaNumericValueClasses().contains(symbol) + maybeOwner == defn.ScalaPackageClass && defn.ScalaNumericValueClasses.contains(symbol) /** Is symbol a class for which no runtime representation exists? */ def isNotRuntimeClass(implicit ctx: Context): Boolean = defn.NotRuntimeClasses contains symbol diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 3108e4d2f98c..9b5d943402f0 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -193,7 +193,7 @@ object TypeErasure { else erase.eraseInfo(tp, sym)(erasureCtx) match { case einfo: MethodType => if (sym.isGetter && einfo.resultType.isRef(defn.UnitClass)) - MethodType(Nil, defn.BoxedUnitType) + MethodType(Nil, defn.BoxedUnitClass.typeRef) else if (sym.isAnonymousFunction && einfo.paramInfos.length > MaxImplementedFunctionArity) MethodType(nme.ALLARGS :: Nil, JavaArrayType(defn.ObjectType) :: Nil, einfo.resultType) else if (sym.name == nme.apply && sym.owner.derivesFrom(defn.PolyFunctionClass)) { @@ -512,9 +512,9 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean private def erasePair(tp: Type)(implicit ctx: Context): Type = { val arity = tp.tupleArity - if (arity < 0) defn.ProductType + if (arity < 0) defn.ProductClass.typeRef else if (arity <= Definitions.MaxTupleArity) defn.TupleType(arity) - else defn.TupleXXLType + else defn.TupleXXLClass.typeRef } /** The erasure of a symbol's info. This is different from `apply` in the way `ExprType`s and diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index 90b4234b44dc..6db008b58d72 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -480,7 +480,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object. */ def featureEnabled(feature: TermName, owner: Symbol = NoSymbol): Boolean = { def hasImport = { - val owner1 = if (!owner.exists) defn.LanguageModuleClass else owner + val owner1 = if (!owner.exists) defn.LanguageModule.moduleClass else owner ctx.importInfo != null && ctx.importInfo.featureImported(feature, owner1)(ctx.withPhase(ctx.typerPhase)) } @@ -673,5 +673,5 @@ object TypeOps { // TODO: Move other typeops here. It's a bit weird that they are a part of `ctx` def nestedPairs(ts: List[Type])(implicit ctx: Context): Type = - (ts :\ (defn.UnitType: Type))(defn.PairType.appliedTo(_, _)) + (ts :\ (defn.UnitType: Type))(defn.PairClass.typeRef.appliedTo(_, _)) } diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index bcd4eb058f91..7a99fb341b9f 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -132,7 +132,7 @@ class ClassfileParser( /** Parse parents for Java classes. For Scala, return AnyRef, since the real type will be unpickled. * Updates the read pointer of 'in'. */ def parseParents: List[Type] = { - val superType = if (isAnnotation) { in.nextChar; defn.AnnotationType } + val superType = if (isAnnotation) { in.nextChar; defn.AnnotationClass.typeRef } else pool.getSuperClass(in.nextChar).typeRef val ifaceCount = in.nextChar var ifaces = for (i <- (0 until ifaceCount).toList) yield pool.getSuperClass(in.nextChar).typeRef @@ -142,7 +142,7 @@ class ClassfileParser( // Consequently, no best implicit for the "Integral" evidence parameter of "range" // is found. Previously, this worked because of weak conformance, which has been dropped. - if (isAnnotation) ifaces = defn.ClassfileAnnotationType :: ifaces + if (isAnnotation) ifaces = defn.ClassfileAnnotationClass.typeRef :: ifaces superType :: ifaces } @@ -176,7 +176,7 @@ class ClassfileParser( } else if (result == Some(NoEmbedded)) { for (sym <- List(moduleRoot.sourceModule, moduleRoot.symbol, classRoot.symbol)) { classRoot.owner.asClass.delete(sym) - if (classRoot.owner == defn.ScalaShadowingPackageClass) { + if (classRoot.owner == defn.ScalaShadowingPackage.moduleClass) { // Symbols in scalaShadowing are also added to scala defn.ScalaPackageClass.delete(sym) } diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 01b51ae7d315..a2dc5c7a0a82 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -849,8 +849,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val start = readIndex readNat() // skip reference for now target.addAnnotation( - Annotation.Child(implicit ctx => - atReadPos(start, () => readSymbolRef()), NoSpan)) + Annotation.Child.later(atReadPos(start, () => readSymbolRef()), NoSpan)) } } @@ -900,7 +899,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas // array elements are trees representing instances of scala.annotation.Annotation SeqLiteral( until(end, () => readClassfileAnnotArg(readNat())), - TypeTree(defn.AnnotationType)) + TypeTree(defn.AnnotationClass.typeRef)) } private def readAnnotInfoArg()(implicit ctx: Context): Tree = { diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 1d6f048df18f..10f7d70d3a65 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -2722,7 +2722,7 @@ object Parsers { case _ => if (mods.is(Opaque)) { val annotType = AppliedTypeTree( - TypeTree(defn.WithBoundsAnnotType), + TypeTree(defn.WithBoundsAnnot.typeRef), bounds.lo.orElse(TypeTree(defn.NothingType)) :: bounds.hi.orElse(TypeTree(defn.AnyType)) :: Nil) rhs = Annotated(rhs, ensureApplied(wrapNew(annotType))) diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index b5fc8830d328..1a874d0df76f 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -125,8 +125,8 @@ class PlainPrinter(_ctx: Context) extends Printer { * They are either aliased in scala.Predef or in the scala package object. */ private[this] lazy val printWithoutPrefix: Set[Symbol] = - (defn.ScalaPredefModuleRef.typeAliasMembers - ++ defn.ScalaPackageObjectRef.typeAliasMembers).map(_.info.classSymbol).toSet + (defn.ScalaPredefModule.termRef.typeAliasMembers + ++ defn.ScalaPackageObject.termRef.typeAliasMembers).map(_.info.classSymbol).toSet def toText(tp: Type): Text = controlled { homogenize(tp) match { diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala index 6201cc9496f1..a0b230b34799 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala @@ -1820,7 +1820,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Definitions_RepeatedParamClass: ClassDefSymbol = defn.RepeatedParamClass def Definitions_OptionClass: Symbol = defn.OptionClass - def Definitions_NoneModule: Symbol = defn.NoneClass.companionModule.asTerm + def Definitions_NoneModule: Symbol = defn.NoneModule def Definitions_SomeModule: Symbol = defn.SomeClass.companionModule.asTerm def Definitions_ProductClass: Symbol = defn.ProductClass diff --git a/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala b/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala index 39260a98850b..1c1ec01eabf2 100644 --- a/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala +++ b/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala @@ -23,14 +23,14 @@ class ArrayApply extends MiniPhase { override def phaseName: String = "arrayApply" override def transformApply(tree: tpd.Apply)(implicit ctx: Context): tpd.Tree = { - if (tree.symbol.name == nme.apply && tree.symbol.owner == defn.ArrayModule) { // Is `Array.apply` + if (tree.symbol.name == nme.apply && tree.symbol.owner == defn.ArrayModule.moduleClass) { // Is `Array.apply` tree.args match { case StripAscription(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: ct :: Nil - if defn.WrapArrayMethods().contains(wrapRefArrayMeth.symbol) && elideClassTag(ct) => + if defn.WrapArrayMethods.contains(wrapRefArrayMeth.symbol) && elideClassTag(ct) => seqLit case elem0 :: StripAscription(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: Nil - if defn.WrapArrayMethods().contains(wrapRefArrayMeth.symbol) => + if defn.WrapArrayMethods.contains(wrapRefArrayMeth.symbol) => tpd.JavaSeqLiteral(elem0 :: seqLit.elems, seqLit.elemtpt) case _ => @@ -51,7 +51,7 @@ class ArrayApply extends MiniPhase { case _: Literal => true // ClassTag.apply(classOf[XYZ]) case rc: RefTree if rc.name == nme.TYPE_ => // ClassTag.apply(java.lang.XYZ.Type) - defn.ScalaBoxedClasses().contains(rc.symbol.maybeOwner.companionClass) + defn.ScalaBoxedClasses.contains(rc.symbol.maybeOwner.companionClass) case _ => false } case Apply(ctm: RefTree, _) if ctm.symbol.maybeOwner.companionModule == defn.ClassTagModule => diff --git a/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala b/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala index e234ab76213d..67a8f66d7326 100644 --- a/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala +++ b/compiler/src/dotty/tools/dotc/transform/ArrayConstructors.scala @@ -31,7 +31,7 @@ class ArrayConstructors extends MiniPhase { if (tree.fun.symbol eq defn.ArrayConstructor) { val TypeApply(tycon, targ :: Nil) = tree.fun expand(targ.tpe, tree.args) - } else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) { + } else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule.moduleClass) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) { val Apply(Apply(TypeApply(_, List(tp)), _), _) = tree val cs = tp.tpe.widen.classSymbol tree.fun match { diff --git a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala index 6209acc906f6..1688e0f0da29 100644 --- a/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala +++ b/compiler/src/dotty/tools/dotc/transform/CapturedVars.scala @@ -32,7 +32,7 @@ class CapturedVars extends MiniPhase with IdentityDenotTransformer { thisPhase = private class RefInfo(implicit ctx: Context) { /** The classes for which a Ref type exists. */ val refClassKeys: collection.Set[Symbol] = - defn.ScalaNumericValueClasses() + defn.BooleanClass + defn.ObjectClass + defn.ScalaNumericValueClasses + defn.BooleanClass + defn.ObjectClass val refClass: Map[Symbol, Symbol] = refClassKeys.map(rc => rc -> ctx.requiredClass(s"scala.runtime.${rc.name}Ref")).toMap diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala index 1f36d76a151b..baf3a7a8b61c 100644 --- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala +++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala @@ -176,7 +176,7 @@ object Erasure { */ private def safelyRemovableUnboxArg(tree: Tree)(implicit ctx: Context): Tree = tree match { case Apply(fn, arg :: Nil) - if isUnbox(fn.symbol) && defn.ScalaBoxedClasses().contains(arg.tpe.widen.typeSymbol) => + if isUnbox(fn.symbol) && defn.ScalaBoxedClasses.contains(arg.tpe.widen.typeSymbol) => arg case _ => EmptyTree @@ -260,7 +260,7 @@ object Erasure { case (JavaArrayType(treeElem), JavaArrayType(ptElem)) if treeElem.widen.isPrimitiveValueType && !ptElem.isPrimitiveValueType => // See SI-2386 for one example of when this might be necessary. - cast(ref(defn.runtimeMethodRef(nme.toObjectArray)).appliedTo(tree), pt) + cast(ref(defn.runtimeMethod(nme.toObjectArray)).appliedTo(tree), pt) // When casting between two EVTs, we need to check which one underlies the other to determine // whether u2evt or evt2u should be used. @@ -507,9 +507,9 @@ object Erasure { } private def runtimeCallWithProtoArgs(name: Name, pt: Type, args: Tree*)(implicit ctx: Context): Tree = { - val meth = defn.runtimeMethodRef(name) - val followingParams = meth.symbol.info.firstParamTypes.drop(args.length) - val followingArgs = protoArgs(pt, meth.widen).zipWithConserve(followingParams)(typedExpr).asInstanceOf[List[tpd.Tree]] + val meth = defn.runtimeMethod(name) + val followingParams = meth.info.firstParamTypes.drop(args.length) + val followingArgs = protoArgs(pt, meth.info).zipWithConserve(followingParams)(typedExpr).asInstanceOf[List[tpd.Tree]] ref(meth).appliedToArgs(args.toList ++ followingArgs) } @@ -642,7 +642,7 @@ object Erasure { override def typedClosure(tree: untpd.Closure, pt: Type)(implicit ctx: Context): Tree = { val xxl = defn.isXXLFunctionClass(tree.typeOpt.typeSymbol) var implClosure @ Closure(_, meth, _) = super.typedClosure(tree, pt) - if (xxl) implClosure = cpy.Closure(implClosure)(tpt = TypeTree(defn.FunctionXXLType)) + if (xxl) implClosure = cpy.Closure(implClosure)(tpt = TypeTree(defn.FunctionXXLClass.typeRef)) implClosure.tpe match { case SAMType(sam) => val implType = meth.tpe.widen.asInstanceOf[MethodType] diff --git a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala index a9b2df9a75b9..37dfdca338aa 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala @@ -108,7 +108,9 @@ class ExpandSAMs extends MiniPhase { case PartialFunctionRHS(pf) => val anonSym = anon.symbol val anonTpe = anon.tpe.widen - val parents = List(defn.AbstractPartialFunctionType.appliedTo(anonTpe.firstParamTypes.head, anonTpe.resultType), defn.SerializableType) + val parents = List( + defn.AbstractPartialFunctionClass.typeRef.appliedTo(anonTpe.firstParamTypes.head, anonTpe.resultType), + defn.SerializableType) val pfSym = ctx.newNormalizedClassSymbol(anonSym.owner, tpnme.ANON_CLASS, Synthetic | Final, parents, coord = tree.span) def overrideSym(sym: Symbol) = sym.copy( @@ -128,7 +130,7 @@ class ExpandSAMs extends MiniPhase { Bind(defaultSym, Underscore(selectorTpe)), EmptyTree, defaultValue) - val unchecked = selector.annotated(New(ref(defn.UncheckedAnnotType))) + val unchecked = selector.annotated(New(ref(defn.UncheckedAnnot.typeRef))) cpy.Match(tree)(unchecked, cases :+ defaultCase) .subst(param.symbol :: Nil, pfParam :: Nil) // Needed because a partial function can be written as: diff --git a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala index 8943477df2de..971aa33f3163 100644 --- a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -107,7 +107,7 @@ class FirstTransform extends MiniPhase with InfoTransformer { thisPhase => if (meth.hasAnnotation(defn.NativeAnnot)) { meth.resetFlag(Deferred) polyDefDef(meth, - _ => _ => ref(defn.Sys_errorR).withSpan(ddef.span) + _ => _ => ref(defn.Sys_error.termRef).withSpan(ddef.span) .appliedTo(Literal(Constant(s"native method stub")))) } diff --git a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala index 297014362ac7..75c7761f6a3c 100644 --- a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala +++ b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala @@ -196,7 +196,7 @@ object GenericSignatures { } } else if (sym == defn.PairClass && tp.tupleArity > Definitions.MaxTupleArity) - jsig(defn.TupleXXLType) + jsig(defn.TupleXXLClass.typeRef) else if (isTypeParameterInSig(sym, sym0)) { assert(!sym.isAliasType, "Unexpected alias type: " + sym) typeParamSig(sym.name.lastPart) @@ -204,14 +204,14 @@ object GenericSignatures { else if (defn.specialErasure.contains(sym)) jsig(defn.specialErasure(sym).typeRef) else if (sym == defn.UnitClass || sym == defn.BoxedUnitModule) - jsig(defn.BoxedUnitType) + jsig(defn.BoxedUnitClass.typeRef) else if (sym == defn.NothingClass) jsig(defn.RuntimeNothingModuleRef) else if (sym == defn.NullClass) - jsig(defn.RuntimeNullModuleRef) + jsig(defn.RuntimeNullModule.termRef) else if (sym.isPrimitiveValueClass) { if (!primitiveOK) jsig(defn.ObjectType) - else if (sym == defn.UnitClass) jsig(defn.BoxedUnitType) + else if (sym == defn.UnitClass) jsig(defn.BoxedUnitClass.typeRef) else builder.append(defn.typeTag(sym.info)) } else if (ValueClasses.isDerivedValueClass(sym)) { diff --git a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala index 2cafd96a3c55..fc75d5f05ded 100644 --- a/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala +++ b/compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala @@ -53,7 +53,7 @@ class InterceptedMethods extends MiniPhase { val s = tree.tpe.widen.typeSymbol def staticsCall(methodName: TermName): Tree = - ref(defn.staticsMethodRef(methodName)).appliedTo(tree) + ref(defn.staticsMethod(methodName)).appliedTo(tree) if (s == defn.NullClass) Literal(Constant(0)) else if (s == defn.DoubleClass) staticsCall(nme.doubleHash) @@ -91,7 +91,7 @@ class InterceptedMethods extends MiniPhase { List(qual, typer.resolveClassTag(tree.pos, qual.tpe.widen)))) }*/ */ - case t if t.name == nme.getClass_ && defn.ScalaValueClasses().contains(t.owner) => + case t if t.name == nme.getClass_ && defn.ScalaValueClasses.contains(t.owner) => // if we got here then we're trying to send a primitive getClass method to either // a) an Any, in which cage Object_getClass works because Any erases to object. Or // diff --git a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala index ea3b1e02f3cd..b6c99e56ebb7 100644 --- a/compiler/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/compiler/src/dotty/tools/dotc/transform/LazyVals.scala @@ -146,7 +146,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer { // val x$lzy = new scala.runtime.LazyInt() val holderName = LazyLocalName.fresh(xname) - val holderImpl = defn.LazyHolder()(ctx)(tpe.typeSymbol) + val holderImpl = defn.LazyHolder(tpe.typeSymbol) val holderSymbol = ctx.newSymbol(x.symbol.owner, holderName, containerFlags, holderImpl.typeRef, coord = x.span) val holderTree = ValDef(holderSymbol, New(holderImpl.typeRef, Nil)) diff --git a/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala b/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala index 4cafed59f8f6..b4d56814137b 100644 --- a/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala +++ b/compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala @@ -26,9 +26,11 @@ class NonLocalReturns extends MiniPhase { if (tree.tpe <:< pt) tree else Erasure.Boxing.adaptToType(tree, pt) + private def nonLocalReturnControl given Context = defn.NonLocalReturnControlClass.typeRef + /** The type of a non-local return expression with given argument type */ private def nonLocalReturnExceptionType(argtype: Type)(implicit ctx: Context) = - defn.NonLocalReturnControlType.appliedTo(argtype) + nonLocalReturnControl.appliedTo(argtype) /** A hashmap from method symbols to non-local return keys */ private val nonLocalReturnKeys = newMutableSymbolMap[TermSymbol] @@ -49,7 +51,7 @@ class NonLocalReturns extends MiniPhase { private def nonLocalReturnThrow(expr: Tree, meth: Symbol)(implicit ctx: Context) = Throw( New( - defn.NonLocalReturnControlType, + nonLocalReturnControl, ref(nonLocalReturnKey(meth)) :: expr.ensureConforms(defn.ObjectType) :: Nil)) /** Transform (body, key) to: @@ -67,7 +69,6 @@ class NonLocalReturns extends MiniPhase { */ private def nonLocalReturnTry(body: Tree, key: TermSymbol, meth: Symbol)(implicit ctx: Context) = { val keyDef = ValDef(key, New(defn.ObjectType, Nil)) - val nonLocalReturnControl = defn.NonLocalReturnControlType val ex = ctx.newSymbol(meth, nme.ex, EmptyFlags, nonLocalReturnControl, coord = body.span) val pat = BindTyped(ex, nonLocalReturnControl) val rhs = If( diff --git a/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala b/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala index bbbbb9f8c814..5f1c769ccb6a 100644 --- a/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala +++ b/compiler/src/dotty/tools/dotc/transform/PCPCheckAndHeal.scala @@ -187,7 +187,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages( assert(ctx.inInlineMethod) None } else { - val reqType = defn.QuotedTypeType.appliedTo(tp) + val reqType = defn.QuotedTypeClass.typeRef.appliedTo(tp) val tag = ctx.typer.inferImplicitArg(reqType, pos.span) tag.tpe match { case _: TermRef => diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala index 189630e902fc..4d11ca143a7b 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -414,7 +414,7 @@ object PatternMatcher { private def matchPlan(tree: Match): Plan = { letAbstract(tree.selector) { scrutinee => - val matchError: Plan = ResultPlan(Throw(New(defn.MatchErrorType, ref(scrutinee) :: Nil))) + val matchError: Plan = ResultPlan(Throw(New(defn.MatchErrorClass.typeRef, ref(scrutinee) :: Nil))) tree.cases.foldRight(matchError) { (cdef, next) => SeqPlan(caseDefPlan(scrutinee, cdef), next) } diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala index 3c65c69cc83f..91d03ddf64c5 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala @@ -207,9 +207,9 @@ class ReifyQuotes extends MacroTransform { ref(defn.LiftableModule).select(name).select("toExpr".toTermName).appliedTo(Literal(Constant(value))).appliedTo(qctx) def pickleAsValue[T](value: T) = { - val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextType, body.span) + val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextClass.typeRef, body.span) if (qctx.tpe.isInstanceOf[SearchFailureType]) - ctx.error(ctx.typer.missingArgMsg(qctx, defn.QuoteContextType, ""), ctx.source.atSpan(body.span)) + ctx.error(ctx.typer.missingArgMsg(qctx, defn.QuoteContextClass.typeRef, ""), ctx.source.atSpan(body.span)) value match { case null => ref(defn.QuotedExprModule).select("nullExpr".toTermName).appliedTo(qctx) case _: Unit => ref(defn.QuotedExprModule).select("unitExpr".toTermName).appliedTo(qctx) @@ -229,9 +229,10 @@ class ReifyQuotes extends MacroTransform { val meth = if (isType) ref(defn.Unpickler_unpickleType).appliedToType(originalTp) else ref(defn.Unpickler_unpickleExpr).appliedToType(originalTp.widen) + def wildcardQuotedType = defn.QuotedTypeClass.typeRef.appliedTo(WildcardType) val spliceResType = - if(isType) defn.QuotedTypeType.appliedTo(WildcardType) - else defn.QuotedExprType.appliedTo(defn.AnyType) | defn.QuotedTypeType.appliedTo(WildcardType) + if (isType) wildcardQuotedType + else defn.QuotedExprClass.typeRef.appliedTo(defn.AnyType) | wildcardQuotedType meth.appliedTo( liftList(PickledQuotes.pickleQuote(body).map(x => Literal(Constant(x))), defn.StringType), liftList(splices, defn.FunctionType(1).appliedTo(defn.SeqType.appliedTo(defn.AnyType), spliceResType))) @@ -313,8 +314,8 @@ class ReifyQuotes extends MacroTransform { } assert(tpw.isInstanceOf[ValueType]) val argTpe = - if (tree.isType) defn.QuotedTypeType.appliedTo(tpw) - else defn.QuotedExprType.appliedTo(tpw) + if (tree.isType) defn.QuotedTypeClass.typeRef.appliedTo(tpw) + else defn.QuotedExprClass.typeRef.appliedTo(tpw) val selectArg = arg.select(nme.apply).appliedTo(Literal(Constant(i))).cast(argTpe) val capturedArg = SyntheticValDef(UniqueName.fresh(tree.symbol.name.toTermName).toTermName, selectArg) i += 1 diff --git a/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala b/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala index 318f16277066..44f207693a4a 100644 --- a/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala +++ b/compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala @@ -112,7 +112,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) { coord = clazz.coord).enteredAfter(thisPhase).asTerm def forwardToRuntime(vrefs: List[Tree]): Tree = - ref(defn.runtimeMethodRef("_" + sym.name.toString)).appliedToArgs(This(clazz) :: vrefs) + ref(defn.runtimeMethod("_" + sym.name.toString)).appliedToArgs(This(clazz) :: vrefs) def ownName: Tree = Literal(Constant(clazz.name.stripModuleClassSuffix.toString)) @@ -312,7 +312,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) { MethodType(Nil, defn.AnyRefType), coord = clazz.coord).entered.asTerm List( DefDef(writeReplace, - _ => New(defn.ModuleSerializationProxyType, + _ => New(defn.ModuleSerializationProxyClass.typeRef, defn.ModuleSerializationProxyConstructor, List(Literal(Constant(clazz.sourceModule.termRef))))) .withSpan(ctx.owner.span.focus)) @@ -436,14 +436,14 @@ class SyntheticMembers(thisPhase: DenotTransformer) { } } def makeSingletonMirror() = - addParent(defn.Mirror_SingletonType) + addParent(defn.Mirror_SingletonClass.typeRef) def makeProductMirror(cls: Symbol) = { - addParent(defn.Mirror_ProductType) - addMethod(nme.fromProduct, MethodType(defn.ProductType :: Nil, monoType.typeRef), cls, + addParent(defn.Mirror_ProductClass.typeRef) + addMethod(nme.fromProduct, MethodType(defn.ProductClass.typeRef :: Nil, monoType.typeRef), cls, fromProductBody(_, _)(_).ensureConforms(monoType.typeRef)) // t4758.scala or i3381.scala are examples where a cast is needed } def makeSumMirror(cls: Symbol) = { - addParent(defn.Mirror_SumType) + addParent(defn.Mirror_SumClass.typeRef) addMethod(nme.ordinal, MethodType(monoType.typeRef :: Nil, defn.IntType), cls, ordinalBody(_, _)(_)) } diff --git a/compiler/src/dotty/tools/dotc/transform/TupleOptimizations.scala b/compiler/src/dotty/tools/dotc/transform/TupleOptimizations.scala index 52f7db1482d6..149ad24c031b 100644 --- a/compiler/src/dotty/tools/dotc/transform/TupleOptimizations.scala +++ b/compiler/src/dotty/tools/dotc/transform/TupleOptimizations.scala @@ -84,7 +84,7 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer { // val it = this.asInstanceOf[Product].productIterator // it.next() // TupleN-1(it.next(), ..., it.next()) - evalOnce(tup.asInstance(defn.ProductType).select(nme.productIterator)) { it => + evalOnce(tup.asInstance(defn.ProductClass.typeRef).select(nme.productIterator)) { it => Block( it.select(nme.next).ensureApplied :: Nil, knownTupleFromIterator(size - 1, it).asInstance(tree.tpe) @@ -92,7 +92,7 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer { } } else { // tup.asInstanceOf[TupleXXL].tailXXL - tup.asInstance(defn.TupleXXLType).select("tailXXL".toTermName) + tup.asInstance(defn.TupleXXLClass.typeRef).select("tailXXL".toTermName) } case None => // No optimization, keep: @@ -159,7 +159,7 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer { Typed(tup, TypeTree(defn.tupleType(tpes))).select(nme.selectorName(n)) } else { // tup.asInstanceOf[TupleXXL].productElement(n) - tup.asInstance(defn.TupleXXLType).select(nme.productElement).appliedTo(Literal(nTpe.value)) + tup.asInstance(defn.TupleXXLClass.typeRef).select(nme.productElement).appliedTo(Literal(nTpe.value)) } case (None, nTpe: ConstantType) if nTpe.value.intValue < 0 => ctx.error("index out of bounds: " + nTpe.value.intValue, nTree.sourcePos) @@ -178,13 +178,13 @@ class TupleOptimizations extends MiniPhase with IdentityDenotTransformer { val size = tpes.size if (size == 0) { // Array.emptyObjectArray - ref(defn.ArrayModule.companionModule).select("emptyObjectArray".toTermName).ensureApplied + ref(defn.ArrayModule).select("emptyObjectArray".toTermName).ensureApplied } else if (size <= MaxTupleArity) { // DynamicTuple.productToArray(tup.asInstanceOf[Product]) - ref(defn.DynamicTuple_productToArray).appliedTo(tup.asInstance(defn.ProductType)) + ref(defn.DynamicTuple_productToArray).appliedTo(tup.asInstance(defn.ProductClass.typeRef)) } else { // tup.asInstanceOf[TupleXXL].elems.clone() - tup.asInstance(defn.TupleXXLType).select(nme.toArray) + tup.asInstance(defn.TupleXXLClass.typeRef).select(nme.toArray) } case None => // No optimization, keep: diff --git a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 548dba2f4de9..cb35bdbfb476 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -286,7 +286,7 @@ object TypeTestsCasts { } case defn.MultiArrayOf(elem, ndims) if isUnboundedGeneric(elem) => def isArrayTest(arg: Tree) = - ref(defn.runtimeMethodRef(nme.isArray)).appliedTo(arg, Literal(Constant(ndims))) + ref(defn.runtimeMethod(nme.isArray)).appliedTo(arg, Literal(Constant(ndims))) if (ndims == 1) isArrayTest(expr) else evalOnce(expr) { e => derivedTree(e, defn.Any_isInstanceOf, e.tpe) diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index c81bda680bbf..460aa8d2ecc3 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -1556,7 +1556,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => case untpd.Function(args, body) => defn.FunctionOf(args map Function.const(defn.AnyType), typeShape(body)) case Match(EmptyTree, _) => - defn.PartialFunctionType.appliedTo(defn.AnyType :: defn.NothingType :: Nil) + defn.PartialFunctionClass.typeRef.appliedTo(defn.AnyType :: defn.NothingType :: Nil) case _ => defn.NothingType } diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index d68e771292de..367f6d7a197a 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -822,7 +822,7 @@ trait Checking { checkInlineConformant(expr, isFinal, what) case SeqLiteral(elems, _) => elems.foreach(elem => checkInlineConformant(elem, isFinal, what)) - case Apply(fn, List(arg)) if defn.WrapArrayMethods().contains(fn.symbol) => + case Apply(fn, List(arg)) if defn.WrapArrayMethods.contains(fn.symbol) => checkInlineConformant(arg, isFinal, what) case _ => def isCaseClassApply(sym: Symbol): Boolean = diff --git a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala index 7dbaee2058fb..700aa032d237 100644 --- a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala +++ b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala @@ -139,7 +139,7 @@ trait Dynamic { self: Typer with Applications => val (fun @ Select(qual, name), targs, vargss) = decomposeCall(tree) def structuralCall(selectorName: TermName, ctags: List[Tree]) = { - val selectable = adapt(qual, defn.SelectableType) + val selectable = adapt(qual, defn.SelectableClass.typeRef) // ($qual: Selectable).$selectorName("$name", ..$ctags) val base = @@ -175,7 +175,7 @@ trait Dynamic { self: Typer with Applications => fail(name, i"has a method type with inter-parameter dependencies") else { val ctags = tpe.paramInfoss.flatten.map(pt => - implicitArgTree(defn.ClassTagType.appliedTo(pt.widenDealias :: Nil), fun.span.endPos)) + implicitArgTree(defn.ClassTagClass.typeRef.appliedTo(pt.widenDealias :: Nil), fun.span.endPos)) structuralCall(nme.applyDynamic, ctags).cast(tpe.finalResultType) } diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index e368f09323cc..13908b9b18a3 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -688,7 +688,7 @@ trait Implicits { self: Typer => case arg :: Nil => fullyDefinedType(arg, "ClassTag argument", span) match { case defn.ArrayOf(elemTp) => - val etag = inferImplicitArg(defn.ClassTagType.appliedTo(elemTp), span) + val etag = inferImplicitArg(defn.ClassTagClass.typeRef.appliedTo(elemTp), span) if (etag.tpe.isError) EmptyTree else etag.select(nme.wrap) case tp if hasStableErasure(tp) && !defn.isBottomClass(tp.typeSymbol) => val sym = tp.typeSymbol @@ -784,7 +784,7 @@ trait Implicits { self: Typer => /** Is there an `Eql[T, T]` instance, assuming -strictEquality? */ def hasEq(tp: Type)(implicit ctx: Context): Boolean = { - val inst = inferImplicitArg(defn.EqlType.appliedTo(tp, tp), span) + val inst = inferImplicitArg(defn.EqlClass.typeRef.appliedTo(tp, tp), span) !inst.isEmpty && !inst.tpe.isError } @@ -887,8 +887,8 @@ trait Implicits { self: Typer => * MirroredTypeConstrictor = * MirroredLabel =