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 WojciechMazur committed Aug 27, 2024
1 parent 337d03a commit a1a7b12
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 @@ -5708,7 +5708,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 @@ -5730,10 +5731,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 @@ -5742,10 +5740,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 a1a7b12

Please sign in to comment.