@@ -1889,31 +1889,40 @@ object Types {
1889
1889
case sym : Symbol => sym.originDenotation.name
1890
1890
}
1891
1891
1892
- /** The signature of the last known denotation, or if there is none, the
1893
- * signature of the symbol. Signatures are always computed before erasure, since
1894
- * some symbols change their signature at erasure.
1892
+ /** The signature computed from the last known denotation with `sigFromDenot`,
1893
+ * or if there is none, the signature of the symbol. Signatures are always
1894
+ * computed before erasure, since some symbols change their signature at erasure.
1895
1895
*/
1896
1896
protected def computeSignature (implicit ctx : Context ): Signature =
1897
1897
val lastd = lastDenotation
1898
- if lastd != null && lastd.validFor.firstPhaseId <= ctx.erasurePhase.id then lastd.signature
1898
+ if lastd != null then sigFromDenot( lastd)
1899
1899
else if ctx.erasedTypes then computeSignature(using ctx.withPhase(ctx.erasurePhase))
1900
1900
else symbol.asSeenFrom(prefix).signature
1901
1901
1902
- /** The signature of the current denotation if it is known without forcing.
1902
+ /** The signature computed from the current denotation with `sigFromDenot` if it is
1903
+ * known without forcing.
1903
1904
* Otherwise the signature of the current symbol if it is known without forcing.
1904
- * Otherwise NotAMethod.
1905
+ * Otherwise NotAMethod. Signatures are always computed before erasure, since
1906
+ * some symbols change their signature at erasure.
1905
1907
*/
1906
1908
private def currentSignature (implicit ctx : Context ): Signature =
1907
1909
if ctx.runId == mySignatureRunId then mySignature
1908
1910
else
1909
1911
val lastd = lastDenotation
1910
- if lastd != null && lastd.validFor.firstPhaseId <= ctx.erasurePhase.id then lastd.signature
1912
+ if lastd != null then sigFromDenot( lastd)
1911
1913
else if ctx.erasedTypes then currentSignature(using ctx.withPhase(ctx.erasurePhase))
1912
1914
else
1913
1915
val sym = currentSymbol
1914
1916
if sym.exists then sym.asSeenFrom(prefix).signature
1915
1917
else Signature .NotAMethod
1916
1918
1919
+ /** The signature of a pre-erasure version of denotation `lastd`. */
1920
+ private def sigFromDenot (lastd : Denotation )(using Context ) =
1921
+ if lastd.validFor.firstPhaseId <= ctx.erasurePhase.id then lastd.signature
1922
+ else lastd match
1923
+ case lastd : SingleDenotation => lastd.initial.signature
1924
+ case _ => Signature .OverloadedSignature
1925
+
1917
1926
final def symbol (implicit ctx : Context ): Symbol =
1918
1927
// We can rely on checkedPeriod (unlike in the definition of `denot` below)
1919
1928
// because SymDenotation#installAfter never changes the symbol
0 commit comments