Skip to content

Commit 56d1fee

Browse files
committed
Eliminate termRefWithSig and valRef
Also, drop signature parameter in TermRef.withSigAndDenot
1 parent f0e43f5 commit 56d1fee

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
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: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ object Types {
19591959
override def isOverloaded(implicit ctx: Context) = denot.isOverloaded
19601960

19611961
private def rewrap(sd: SingleDenotation)(implicit ctx: Context) =
1962-
TermRef.withSigAndDenot(prefix, name, sd)
1962+
TermRef(prefix, name, sd)
19631963

19641964
def alternatives(implicit ctx: Context): List[TermRef] =
19651965
denot.alternatives map rewrap
@@ -2063,23 +2063,12 @@ object Types {
20632063
* signature, if denotation is not yet completed.
20642064
*/
20652065
def apply(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = {
2066-
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically)
2067-
apply(prefix, denot.symbol.asTerm)
2066+
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically) apply(prefix, denot.symbol.asTerm)
20682067
else denot match {
2069-
case denot: SymDenotation if denot.isCompleted =>
2070-
apply(prefix, name.withSig(denot.signature))
2071-
case _ =>
2072-
apply(prefix, name)
2068+
case denot: SingleDenotation => apply(prefix, name.withSig(denot.signature))
2069+
case _ => apply(prefix, name)
20732070
}
20742071
} withDenot denot
2075-
2076-
/** Create a term ref with given prefix, name, signature, and initial denotation */
2077-
def withSigAndDenot(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = {
2078-
if ((prefix eq NoPrefix) || denot.symbol.isReferencedSymbolically)
2079-
apply(prefix, denot.symbol.asTerm)
2080-
else
2081-
apply(prefix, name.withSig(denot.signature))
2082-
} withDenot denot
20832072
}
20842073

20852074
object TypeRef {

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
@@ -1904,7 +1904,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19041904
def adaptOverloaded(ref: TermRef) = {
19051905
val altDenots = ref.denot.alternatives
19061906
typr.println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
1907-
val alts = altDenots.map(TermRef.withSigAndDenot(ref.prefix, ref.name, _))
1907+
val alts = altDenots.map(TermRef(ref.prefix, ref.name, _))
19081908
resolveOverloaded(alts, pt) match {
19091909
case alt :: Nil =>
19101910
adapt(tree.withType(alt), pt)

0 commit comments

Comments
 (0)