@@ -187,6 +187,7 @@ trait Types
187187 override def widen = maybeRewrap(underlying.widen)
188188 override def narrow = underlying.narrow
189189 override def deconst = maybeRewrap(underlying.deconst)
190+ override def deconstWiden = maybeRewrap(underlying.deconstWiden)
190191 override def resultType = maybeRewrap(underlying.resultType)
191192 override def resultType (actuals : List [Type ]) = maybeRewrap(underlying.resultType(actuals))
192193 override def paramSectionCount = 0
@@ -353,6 +354,11 @@ trait Types
353354 */
354355 def deconst : Type = this
355356
357+ /** Map a constant type or not-null-type to its underlying base type,
358+ * identity for all other types.
359+ */
360+ def deconstWiden : Type = this
361+
356362 /** The type of `this` of a class type or reference type. */
357363 def typeOfThis : Type = typeSymbol.typeOfThis
358364
@@ -1844,6 +1850,7 @@ trait Types
18441850 override def underlying : Type = if (sip23 && value.isSuitableLiteralType) LiteralType (value) else value.tpe // SIP-23
18451851 override def isTrivial : Boolean = true
18461852 override def deconst : Type = underlying.deconst
1853+ override def deconstWiden : Type = if (value.isSuitableLiteralType) underlying.widen else deconst
18471854 override def safeToString : String =
18481855 underlying.widen.toString + " (" + value.escapedStringValue + " )"
18491856 override def kind = " ConstantType"
0 commit comments