Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
durban committed May 11, 2024
1 parent 6a43ba4 commit e3d26fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ final class MutDescriptor private (

final override type D = MutDescriptor

final override def self: MutDescriptor =
this

final override def readOnly: Boolean =
this.map.definitelyReadOnly

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ abstract class AbstractDescriptor extends AbstractDescriptorPlatform {

type D <: AbstractDescriptor

def self: D

def readOnly: Boolean

def validTs: Long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ final class Descriptor private (

final override type D = Descriptor

final override def self: D =
this

final override val readOnly: Boolean =
this.map.definitelyReadOnly && (!this.hasVersionCas)

Expand Down Expand Up @@ -332,8 +329,17 @@ object Descriptor {
}
if (needToExtend) {
merged = ctx.validateAndTryExtend(merged, hwd = null) match {
case null => null // couldn't extend
case extended => extended.self // TODO: can we avoid `.self` here?
case null =>
// couldn't extend:
null
case extended =>
// we know it's immutable here
// (so `toImmutable` is a NOP),
// we just need to convince scalac
// that it's type is `Descriptor`:
val r = extended.toImmutable
assert(r eq extended)
r
}
}
merged
Expand Down

0 comments on commit e3d26fc

Please sign in to comment.