Skip to content

Cache skolem types #14909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4621,11 +4621,12 @@ object Types {
* Note that care is needed when creating them, since not all types need to be inhabited.
* A skolem is equal to itself and no other type.
*/
case class SkolemType(info: Type) extends UncachedProxyType with ValueType with SingletonType {
case class SkolemType(info: Type) extends CachedProxyType with ValueType with SingletonType {
override def underlying(using Context): Type = info
def derivedSkolemType(info: Type)(using Context): SkolemType =
if (info eq this.info) this else SkolemType(info)
override def hashCode: Int = System.identityHashCode(this)

override def computeHash(bs: Binders): Int = identityHash(bs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return NotCached if info itself is not cache-able?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, a skolem is in any case unique. We never merge two skolems. So it does not matter whether we
cache the info or not.

override def equals(that: Any): Boolean = this.eq(that.asInstanceOf[AnyRef])

def withName(name: Name): this.type = { myRepr = name; this }
Expand Down