Skip to content

Commit 48231de

Browse files
committed
Eliminate TermRef.withSigAndDenot
1 parent c582c7c commit 48231de

File tree

5 files changed

+7
-22
lines changed

5 files changed

+7
-22
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
702702
TypeRef(tree.tpe, sym.name.asTypeName)
703703
}
704704
else
705-
TermRef.withSigAndDenot(tree.tpe, sym.name.asTermName,
706-
sym.denot.asSeenFrom(tree.tpe))
705+
TermRef(tree.tpe, sym.name.asTermName, sym.denot.asSeenFrom(tree.tpe))
707706
untpd.Select(tree, sym.name).withType(tp)
708707
}
709708

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ object Annotations {
140140

141141
def makeAlias(sym: TermSymbol)(implicit ctx: Context) =
142142
apply(defn.AliasAnnot, List(
143-
ref(TermRef.withSigAndDenot(sym.owner.thisType, sym.name, sym))))
143+
ref(TermRef(sym.owner.thisType, sym.name, sym))))
144144

145145
def makeChild(delayedSym: Context => Symbol)(implicit ctx: Context): Annotation = {
146146
def makeChildLater(implicit ctx: Context) = {

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ object Types {
19621962
override def isOverloaded(implicit ctx: Context) = denot.isOverloaded
19631963

19641964
private def rewrap(sd: SingleDenotation)(implicit ctx: Context) =
1965-
TermRef.withSigAndDenot(prefix, name, sd)
1965+
TermRef(prefix, name, sd)
19661966

19671967
def alternatives(implicit ctx: Context): List[TermRef] =
19681968
denot.alternatives map rewrap
@@ -2066,22 +2066,8 @@ object Types {
20662066
* signature, if denotation is not yet completed.
20672067
*/
20682068
def apply(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = {
2069-
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically)
2070-
apply(prefix, denot.symbol.asTerm)
2071-
else denot match {
2072-
case denot: SymDenotation if denot.isCompleted =>
2073-
apply(prefix, name.withSig(denot.signature))
2074-
case _ =>
2075-
apply(prefix, name)
2076-
}
2077-
} withDenot denot
2078-
2079-
/** Create a term ref with given prefix, name, signature, and initial denotation */
2080-
def withSigAndDenot(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = {
2081-
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically)
2082-
apply(prefix, denot.symbol.asTerm)
2083-
else
2084-
apply(prefix, name.withSig(denot.signature))
2069+
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically) apply(prefix, denot.symbol.asTerm)
2070+
else apply(prefix, name.withSig(denot.signature))
20852071
} withDenot denot
20862072
}
20872073

compiler/src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class ImportInfo(symf: Context => Symbol, val selectors: List[untpd.Tree],
102102
for {
103103
renamed <- reverseMapping.keys
104104
denot <- pre.member(reverseMapping(renamed)).altsWith(_ is Implicit)
105-
} yield TermRef.withSigAndDenot(pre, renamed, denot)
105+
} yield TermRef(pre, renamed, denot)
106106
}
107107

108108
/** The root import symbol hidden by this symbol, or NoSymbol if no such symbol is hidden.

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19051905
def adaptOverloaded(ref: TermRef) = {
19061906
val altDenots = ref.denot.alternatives
19071907
typr.println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
1908-
val alts = altDenots.map(TermRef.withSigAndDenot(ref.prefix, ref.name, _))
1908+
val alts = altDenots.map(TermRef(ref.prefix, ref.name, _))
19091909
resolveOverloaded(alts, pt) match {
19101910
case alt :: Nil =>
19111911
adapt(tree.withType(alt), pt)

0 commit comments

Comments
 (0)