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