Skip to content

Revert Definitions Changes #6962

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ 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.BoxesRunTimeModule.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol
val externalEquals: Symbol = defn.BoxesRunTimeClass.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()
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.BoxesRunTimeModule.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol
defn.BoxesRunTimeClass.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)(
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ object desugar {
else if (isObject)
parents1 = parents1 :+ scalaDot(nme.Serializable.toTypeName)
if (isEnum)
parents1 = parents1 :+ ref(defn.EnumClass.typeRef)
parents1 = parents1 :+ ref(defn.EnumType)

// derived type classes of non-module classes go to their companions
val (clsDerived, companionDerived) =
Expand Down Expand Up @@ -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.UncheckedAnnot.typeRef)))
val sel1 = Annotated(sel, New(ref(defn.UncheckedAnnotType)))
if (checkMode != MatchCheck.None) sel1.pushAttachment(CheckIrrefutable, checkMode)
sel1
}
Expand Down Expand Up @@ -1561,7 +1561,7 @@ object desugar {
val seqType = if (ctx.compilationUnit.isJava) defn.ArrayType else defn.SeqType
Annotated(
AppliedTypeTree(ref(seqType), t),
New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil))
New(ref(defn.RepeatedAnnotType), Nil :: Nil))
} else {
assert(ctx.mode.isExpr || ctx.reporter.errorsReported || ctx.mode.is(Mode.Interactive), ctx.mode)
Select(t, op.name)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object DesugarEnums {
.withFlags(Synthetic)
val privateValuesDef =
ValDef(nme.DOLLAR_VALUES, TypeTree(),
New(TypeTree(defn.EnumValuesClass.typeRef.appliedTo(enumClass.typeRef :: Nil)), ListOfNil))
New(TypeTree(defn.EnumValuesType.appliedTo(enumClass.typeRef :: Nil)), ListOfNil))
.withFlags(Private)

val valuesOfExnMessage = Apply(
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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, sym)
assert(sym.name.isSetterName && sym.info.firstParamTypes.nonEmpty)
sym
}
val qual = tree match {
Expand Down Expand Up @@ -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.PairClass.typeRef), x :: acc :: Nil))
ts.foldRight[Tree](TypeTree(defn.UnitType))((x, acc) => AppliedTypeTree(TypeTree(defn.PairType), x :: acc :: Nil))

/** Replaces all positions in `tree` with zero-extent positions */
private def focusPositions(tree: Tree)(implicit ctx: Context): Tree = {
Expand Down
11 changes: 5 additions & 6 deletions compiler/src/dotty/tools/dotc/core/Annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ 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 = {
Expand Down Expand Up @@ -151,17 +150,17 @@ object Annotations {
object Child {

/** A deferred annotation to the result of a given child computation */
def later(delayedSym: given Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
def apply(delayedSym: Context => Symbol, span: Span)(implicit ctx: Context): Annotation = {
def makeChildLater(implicit ctx: Context) = {
val sym = delayedSym
New(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil)
val sym = delayedSym(ctx)
New(defn.ChildAnnotType.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 = later(given _ => sym, span)
def apply(sym: Symbol, span: Span)(implicit ctx: Context): Annotation = apply(_ => sym, span)

def unapply(ann: Annotation)(implicit ctx: Context): Option[Symbol] =
if (ann.symbol == defn.ChildAnnot) {
Expand Down Expand Up @@ -193,7 +192,7 @@ object Annotations {

def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context): Annotation = {
val tref = cls.typeRef
Annotation(defn.ThrowsAnnot.typeRef.appliedTo(tref), Ident(tref))
Annotation(defn.ThrowsAnnotType.appliedTo(tref), Ident(tref))
}

/** A decorator that provides queries for specific annotations
Expand Down
Loading