Skip to content

Commit

Permalink
Fix AliasingBounds#derivedAlias
Browse files Browse the repository at this point in the history
an omission from ef7db7a

[Cherry-picked 1bfa819]
  • Loading branch information
EugeneFlesselle authored and prolativ committed Nov 20, 2024
1 parent ad6eb2b commit 0394d8f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5286,7 +5286,8 @@ object Types extends TypeUtils {
/** Common supertype of `TypeAlias` and `MatchAlias` */
abstract class AliasingBounds(val alias: Type) extends TypeBounds(alias, alias) {

def derivedAlias(alias: Type)(using Context): AliasingBounds
def derivedAlias(alias: Type)(using Context): AliasingBounds =
if alias eq this.alias then this else AliasingBounds(alias)

override def computeHash(bs: Binders): Int = doHash(bs, alias)
override def hashIsStable: Boolean = alias.hashIsStable
Expand All @@ -5306,10 +5307,7 @@ object Types extends TypeUtils {

/** = T
*/
class TypeAlias(alias: Type) extends AliasingBounds(alias) {
def derivedAlias(alias: Type)(using Context): AliasingBounds =
if (alias eq this.alias) this else TypeAlias(alias)
}
class TypeAlias(alias: Type) extends AliasingBounds(alias)

/** = T where `T` is a `MatchType`
*
Expand All @@ -5318,10 +5316,7 @@ object Types extends TypeUtils {
* If we assumed full substitutivity, we would have to reject all recursive match
* aliases (or else take the jump and allow full recursive types).
*/
class MatchAlias(alias: Type) extends AliasingBounds(alias) {
def derivedAlias(alias: Type)(using Context): AliasingBounds =
if (alias eq this.alias) this else MatchAlias(alias)
}
class MatchAlias(alias: Type) extends AliasingBounds(alias)

object TypeBounds {
def apply(lo: Type, hi: Type)(using Context): TypeBounds =
Expand Down

0 comments on commit 0394d8f

Please sign in to comment.